Non-square (rectangular) maps in R-ggmap
Asked Answered
P

1

5

I need to plot spatial data in a non-square map.

I have been using ggmap, and supposedly you can get non squared maps giving low-west-corner and upper-right-corner coordinates. However, actually it seems it doesn't work (reported here and here).

Anyone knows how to get rectangular maps in R/ggmap?

Publea answered 9/7, 2015 at 11:26 Comment(0)
M
12

If you can live without Google Maps, there are easy, immediate alternatives (I'd've included CloudMade but I don't have an enterprise account):

library(ggmap)

loc <- c(-96, 29.4, -94, 30.2)

# gmaps

tx_map_gmaps <- get_map(location=loc, source="google", maptype="terrain")
gg <- ggmap(tx_map_gmaps)
gg

enter image description here

# openstreetmap

tx_map_osm <- get_map(location=loc, source="osm")
gg <- ggmap(tx_map_osm)
gg

enter image description here

# stamen

tx_map_stamen <- get_map(location=loc, source="stamen", maptype="toner")
gg <- ggmap(tx_map_stamen)
gg

enter image description here

And, if you're willing to fiddle with initial zoom settings & then cropping (and, perhaps, some tile graininess), you can do it with Google Maps:

tx_map_gmaps <- get_map(location=loc, source="google", maptype="terrain")
gg <- ggmap(tx_map_gmaps)
gg <- gg + scale_y_continuous(limits=c(29.5, 30.0))
gg

enter image description here

(I didn't fiddle with said initial zoom, but you shld be able to get the idea.)

Merrell answered 9/7, 2015 at 13:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.