简体   繁体   English

如何从R中的州边界获取经纬度数据

[英]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. 我对R很陌生,但我知道它有一些软件包可以绘制地图,还可以从城市,国家/地区等获取纬度和经度数据。

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. 我需要数据来构造映射后,但我不知道是否有可能在R中获得这种数据。

Can someone help me? 有人能帮我吗?

I think that you want to download the shp file and not the r poly file. 我认为您要下载的是shp文件而不是r poly文件。 You can then simply unzip and then use the maptools package to load the shape file. 然后,您可以简单地解压缩,然后使用maptools包加载形状文件。

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. 我相信您可以使用图简单地在其他shp文件上分层。 You may have to merge the spatial lines data frames to use other graphics packages such as ggplot2. 您可能必须合并空间线数据框才能使用其他图形包,例如ggplot2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从R中的城市名称和国家/地区获取经度和纬度坐标? - How to get the longitude and latitude coordinates from a city name and country in R? 如何从R中的经度和纬度中获取位置名称,以获取完整的数据集? - How to get location name from latitude and longitude in R for a complete dataset? 使用 R 中的 Leaflet 从 shapefile 获取经度和纬度 - Get longitude and latitude from a shapefile with Leaflet in R 从坐标数据转换为R中的经度和纬度? - converting from coordinate data to latitude and longitude in R? 从 R 中的经度和纬度获取国家和州/省名称的有效方法? - Efficient way to get country & state/province names from longitude and latitude in R? 如何在R中使用ggvis将州名转换为纬度和经度以创建Choropleth? - How to convert state name to latitude and longitude to create choropleth with ggvis in R? 从城市和州输入获取经度和纬度的快速方法 - Quick way to get longitude & latitude from City & State input 纬度经度坐标到 R 中的状态代码 - Latitude Longitude Coordinates to State Code in R 从R中的经度和纬度点获取国家(和大陆) - Get country (and continent) from longitude and latitude point in R 使用r中的选择器小工具从地图对象中获取纬度和经度 - Get latitude and longitude from map object using selector gadget in r
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM