Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-square (rectangular) maps in R-ggmap

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?

like image 489
user3507584 Avatar asked Jul 09 '15 11:07

user3507584


1 Answers

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.)

like image 154
hrbrmstr Avatar answered Oct 23 '22 06:10

hrbrmstr