如何通过阅读r中的shapefile解决问题

发布于 2025-02-04 10:59:52 字数 528 浏览 5 评论 0原文

我如何显示zip文件中的shapefile格式的地图。文件是:

library(rgdal)

temp <- tempfile()
download.file("https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/UFs/PR/pr_municipios.zip",temp)
data <- readOGR(unz(temp, "41MUE250GC_SIR.shp"))

该地图看起来像下面的图:

”在此处输入图像描述”

How do I show a map that is in shapefile format that is in a zip file. The file is this:

https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/UFs/PR/pr_municipios.zip

I tried to do the following:

library(rgdal)

temp <- tempfile()
download.file("https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/UFs/PR/pr_municipios.zip",temp)
data <- readOGR(unz(temp, "41MUE250GC_SIR.shp"))

But it did not work.

The map will look like the one below:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛装女皇 2025-02-11 10:59:53

尝试此

library(rgdal)

temp <- tempfile()
temp2 <- tempfile()
download.file("https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/UFs/PR/pr_municipios.zip",temp)

unzip(zipfile = temp, exdir = temp2)
shp <- readOGR(temp2)

plot(shp)

Try this

library(rgdal)

temp <- tempfile()
temp2 <- tempfile()
download.file("https://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/UFs/PR/pr_municipios.zip",temp)

unzip(zipfile = temp, exdir = temp2)
shp <- readOGR(temp2)

plot(shp)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文