Question

When I geocode with ggmap:

library(ggmap)    
map_obj <- get_map("Anchorage, AK")

how do I find the lat and long ranges it has? I can do a str(map_obj) and see $ll.lat, $ll.lon ... but how can I get these? I've tried map_obj$ll.lon

I'm asking this question because I would like to subset my data points to only the visible area of the map instead of throwing the entire lat and long vectors at ggmap.

Was it helpful?

Solution

To get all the bounding box data:

attr(map_obj, "bb")

To get a specific coordinate:

attr(map_obj, "bb")$ll.lat

(and so on)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top