2

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)

The result

Joseph
  • 49
  • 2

1 Answers1

1

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.

hawaiiMap

heds1
  • 3,203
  • 2
  • 17
  • 32
  • Yes, should be baseArchipelago. My mistake. I used 4 coordinates (not 3) for the corners of the map. Your method did not work. It extended the map beyond -180 like I did before but that region still only a grid, no map (see the image link I posted) – Joseph Jun 08 '19 at 23:00
  • Interesting. Are you using the Google Maps API? – heds1 Jun 08 '19 at 23:16