I am using newobj <- nowrapRecenter(obj), from the package maptools to recenter a SpatialPolygonsDataFrame such that longitude runs 0 - 360 (pacific view) rather than -180 to 180 (Atlantic view). Unfortunately, the resulting newobj is a SpatialPolygon only --- the data is lost. I expect I can merge the data back on, but I'm not sure how... generally I would merge by a data column, and this new polygon has no data.

I am using this GEOLEV1 shapefile:



Everything should be ordered so, it is probably as simple as coercing back to a SpatialPolygonsDataFrame object. Say y is the original data and x is the new SpatialPolygons object you could try: new <- SpatialPolygonsDataFrame(x, y@data)

  • Thanks! You're so right, that works perfectly. Thanks a ton, I really appreciate it. : ) – Leah Bevis Sep 16 '16 at 18:51
  • @LeahBevis, if this answer was helpful to you, then upvote it. If it solved your question, then accept it (green checkmark under the vote arrows). See: gis.stackexchange.com/help/someone-answers. Tks. – Andre Silva Apr 1 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.