Reputation: 49
I'm trying to map the locations of a certain plant species on the extended northwestern Hawaiian islands. I'm using ggplot2 and ggmap but only longitudinal coordinates between -180° and 180° are allowed. How can I extend the map beyond the -180° mark to -185° (which would be 175° E)?
Alternatively, is it possible to shift the center of the map from the meridian line (0°) to the antimeridian line (-180°/180°)?
My code:
baseArchipelago = get_map(location=c(-185,7,-154.5,29.3), zoom=6, maptype="terrain",)
mapArchipelago<-ggmap(baseArchipelago)
Upvotes: 2
Views: 251
Reputation: 3438
Here is one solution:
baseArchipelago = get_map(location=c(-160, 19), zoom=4, maptype="terrain")
ggmap(baseArchipelago) +
coord_fixed(xlim = c(-155, -185), ylim=c(30, 10), ratio=1/cos(pi*19/180))
Here, I'm creating quite a large base map, and then using coord_fixed
to zoom in (going past the antimeridian, while keeping Hawaii in the view). The ratio=1/cos(pi*19/180)
requires the lat
coordinate (19). See Pere's response to this question for more info.
Upvotes: 1