【发布时间】:2021-07-25 08:37:55
【问题描述】:
我是 geospatial 数据的新手,尝试使用 .shp 文件进行绘图,但出现错误。
这个.shp文件中的几何类型是LINESTRING,这似乎与我在使用sf之前绘制的MULTIPOLYGON不同
形状文件来源: https://github.com/johnsnow09/covid19-df_stack-code/blob/main/in_country_boundaries.shp
shapefile的原始来源: https://github.com/wri/wri-bounds/blob/master/dist/in_countries.zip
预期结果:
代码尝试:
library(tidyverse)
library(sf)
ind_global <- sf::read_sf("path/in_country_boundaries.shp")
ind_global
输出
Simple feature collection with 412 features and 9 fields
Geometry type: LINESTRING
Dimension: XY
Bounding box: xmin: -141.0056 ymin: -54.88624 xmax: 140.9776 ymax: 70.07531
Geodetic CRS: WGS 84
ind_global %>%
st_as_sf() %>%
ggplot() +
geom_sf()
st_cast.POINT(X[[i]], ...) 中的错误:无法创建 MULTILINESTRING 起点
我需要以其他方式处理LINESTRINGgeometry .shp 文件吗?
【问题讨论】:
标签: r ggplot2 geospatial sf