所以我有两个 SF 对象,一个多边形和一个多边形类,代表一个城市的社区和子社区。两者都来自 ArcGIS,并且覆盖完全相同的区域。但是,当我绘制这两个对象时,子社区在我的传单图中略有错位, 如此处所示。原来的预测是:
iver `ESRI Shapefile'
Simple feature collection with 92 features and 19 fields
geometry type: POLYGON
dimension: XY
bbox: xmin: 55500 ymin: 428647.4 xmax: 101032.6 ymax: 447000
epsg (SRID): NA
proj4string: +proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs
ESRI Shapefile'
Simple feature collection with 7 features and 7 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 438682.1 ymin: 6771629 xmax: 512270.9 ymax: 6800944
epsg (SRID): 3857
proj4string: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
之后,我使用 st_transform 将两者都更改为 WGS84。
传单代码是:
leaflet(width = "100%") %>%
addProviderTiles("Stamen.Terrain") %>%
setView(lng = 4.314960, lat = 51.916024, zoom = 10) %>%
addPolygons(data = rtdm_gebieden, weight = 2, color = "black", fillOpacity = 0.8, fillColor = groen_kleuren) %>%
addPolygons(data = rtdm_buurten, weight = 2, color = "red")
我怀疑这是因为 sf 对象的 bbox 略有不同
SF 对象 1
Geometry set for 92 features
geometry type: POLYGON
dimension: XY
bbox: xmin: 3.940974 ymin: 51.84307 xmax: 4.602129 ymax: 52.0055
epsg (SRID): 4326
proj4string: +proj=longlat +datum=WGS84 +no_defs
科幻对象 2
Geometry set for 7 features
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 3.940748 ymin: 51.84212 xmax: 4.601808 ymax: 52.00453
epsg (SRID): 4326
proj4string: +proj=longlat +datum=WGS84 +no_defs
我尝试将一个的 bbox 设置为另一个的 bbox,但使用 st_bbox 不起作用。任何帮助将不胜感激!