[R-sig-Geo] Projected SpatialLinesDataFrame has a segment spanning the globe
Ry Guy
rr2box42 at gmail.com
Thu Oct 31 22:01:07 CET 2013
Hi All,
I'm trying to use the 'coastsCoarse' dataset from library 'rworldmap' as a base map for plotting a global dataset. It works fine when I use unprojected data. However, if I project the data and base map, coastsCoarse ends up with one horizontal line segment that spans the whole map. You can see what I mean like this:
# ---------------------------------------
library(rgdal)
library(rworldmap)
data(coastsCoarse)
plot(coastsCoarse) # Looks good
mercator.proj4 = "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
coastsMerc = spTransform(coastsCoarse, CRS(mercator.proj4))
spplot(coastsMerc) # horizontal line across plot connects east and west Beringia...
# ---------------------------------------
It seems like the boundary of northern Russia didn't get cut off correctly. I imagine the fix is straightforward, but I've been banging away at it to no avail. Does anyone have a simple solution that either (a) locates and removes the offending pan-global segment or (b) doesn't produce it to begin with?
Thanks much,
Ryan
More information about the R-sig-Geo
mailing list