简体   繁体   中英

How to get latitude and longitude data from the borders of a state in R

Here is my problem: I need to get longitude and latitude data from the borders of the Brazilian states. With this data I can plot a map of each Brazilian state and, of course, of the whole country.

I'm quite new to R but I know it has some packages to plot maps and also to get latitude and longitude data from cities, countries, etc.

The problem is that I need latitude and longitude from the bordes of each state and not just the map. I need the data to after construct the map and I don't know if it's possible to get this sort of data in R.

Can someone help me?

I think that you want to download the shp file and not the r poly file. You can then simply unzip and then use the maptools package to load the shape file.

require(maptools)
brazil <- readShapeLines("BRA_adm0.shp")
plot(brazil)

This will actually produce a plot of the outline of brazil. I believe you can simply layer on the additional shp files using plot. You may have to merge the spatial lines data frames to use other graphics packages such as ggplot2.

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