[R-sig-Geo] How to overlay world map using non-standard projection
ElenaC
E.Couce.07 at bristol.ac.uk
Wed Jan 19 23:50:11 CET 2011
Dear all,
I have a SpatialGrid (covering the entire world) in geographical coordinates
that I'm trying to transform to equal-area cylindrical projection (such as
given by CRS("+proj=cea +lat ts=30")). I also want to center the plot in the
Pacific and overlay a map of the coasts on top.
I have successfully transformed my SpatialGrid using the functions
"projectExtent()" and "projectRaster()" from the raster package, and I've
also centered the data where I want.
Problem is that I've been unable to overlay a map of the world. I've tried
to use the map() function, and I've generated the map I want (right
projection and centered correctly) with the call:
library(maps)
world <-map(projection = "cylequalarea", parameter=30, interior=FALSE,
wrap=TRUE, ylim=c(-60,60),xlim=c(-180,180), orientation=c(90,-205,0))
But when I try to overlay this map on the plot of my transformed SpatialGrid
I find that the scale of both maps is completely different. Their
coordinates don't match:
> bbox(mydata)
min max
s1 -17352991 17352991
s2 -6291291 6356742
> range(world$x, na.rm=TRUE)
[1] -2.355834 2.355591
> range(world$y, na.rm=TRUE)
[1] -0.8613535 0.8899210
Moreover, it looks like it is a different scale factor affecting the 'x'
and 'y' axis. Since the projection I'm trying to use dictates the ratio
between the x and y axis, I don't understand how this can be.
Any suggestion on how to proceed would be greatly appreciated..
Thanks,
Elena
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/How-to-overlay-world-map-using-non-standard-projection-tp5941681p5941681.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list