简体   繁体   中英

How to get the bounding box for a particular city for openmap() in R?

I'm trying to plot a map of San Francisco using R and perform some operations over it. I am not understanding about the calculation of bounding box given a specific city. I am new to R please help me with this.

install.packages("OpenStreetMap")
library(OpenStreetMap)

#City of San Francisco 37.6213° N, 122.3790° W

SFO_map=openmap(c( ),c( ),type="osm")
plot(SFO_map)

I use https://boundingbox.klokantech.com/ and select the visual bounding box on the place I am interested. If you select TSV it gives you the bounding box: 在此输入图像描述

You need to identify upper left coordinates for SF (far west part of the City, like the Presidio and north, like the Golden Gate Bridge) and lower right coordinates (far east, like west Oakland, and south, perhaps Pacific Grove), then put them in the right order in the call. By 'right order', the first latitude is less than the second latitude (or that is what I think I learned from trial and error.). Here is the map of part of Princeton, NJ.

Princeton_map <- openmap(c(40.3832,-74.674273), c(40.339373,-74.661333), type="osm")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM