You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shapefile空间连接匹配错误排查:国别多边形名称不匹配

空间连接Shapefile时匹配错误排查求助

我有两份覆盖世界不同区域、名称体系不同的Shapefile,需要将countries中的多边形名称与countries_GIFT中的条目匹配。此前处理其他Shapefile均正常,但本次空间连接后的数据框出现匹配错误:例如countries中俄罗斯的条目,在countries_GIFT中被识别为爱沙尼亚,经坐标校验该点确实位于俄罗斯境内。我已检查两份Shapefile的投影(均转换为CRS 4326)及区域重叠情况,仍无法定位问题。


相关代码

library(sf)
library(tidyverse)
library(GIFT)

setwd(dirname(rstudioapi::getActiveDocumentContext()$path))

sf_use_s2(FALSE)

countries <- st_read("../../../../locations/Shapefiles/Locations.shp")
countries <- st_transform(countries, crs = 4326)

GIFT_shapes <- GIFT_shapes() # retrieves all shapefiles by default

countries_GIFT <- GIFT_shapes() 
countries_GIFT_crs <- st_transform(countries_GIFT, crs = 4326)

gift_stand_countries <- st_join(countries_GIFT_crs, countries, join = st_intersects)

# Check if regions overlap
ggplot() +
  geom_sf(data = countries_GIFT_crs, fill = "lightblue", color = "black") +
  geom_sf(data = countries, fill = NA, color = "red")

两份数据几何信息

countries几何信息

head(countries$geometry)
Geometry set for 6 features 
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -178.8733 ymin: -14.54889 xmax: 74.89291 ymax: 71.33334
Geodetic CRS:  WGS 84
First 5 geometries:
MULTIPOLYGON (((71.00423 38.47541, 71.02091 38....
MULTIPOLYGON (((20.97472 59.96736, 20.98694 59....
MULTIPOLYGON (((-178.8139 51.8375, -178.7424 51...
MULTIPOLYGON (((19.59271 41.63155, 19.59014 41....
MULTIPOLYGON (((-1.630694 35.21958, -1.630972 3...

countries_GIFT_crs几何信息

head(countries_GIFT_crs$geometry)
Geometry set for 6 features 
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -180 ymin: -90 xmax: 180 ymax: 83.6
Geodetic CRS:  WGS 84
First 5 geometries:
MULTIPOLYGON (((-81.81 24.54, -81.77 24.54, -81...
MULTIPOLYGON (((145.99 43.37, 146.01 43.36, 146...
MULTIPOLYGON (((140.87 51.42, 140.88 51.43, 140...
MULTIPOLYGON (((166.4939 -78.21118, 166.6582 -7...
MULTIPOLYGON (((145.99 43.37, 146.01 43.36, 146...

两份Shapefile叠加图

两份Shapefile叠加图

内容的提问来源于stack exchange,提问作者msug

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 01:20:22