在sf对象上设置右crs绘制坐标点
Set the right crs on sf object to plot coordinate points
我正在尝试为我的 sf
对象定义正确的 CRS。我想在下一层(国家:荷兰)上绘制点:
Simple feature collection with 380 features and 3 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 13565.4 ymin: 306846.2 xmax: 278026.1 ymax: 619232.6
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
输出:
这一层有正确的投影。
但是 POINT
层没有正确的 CRS 项目,大概是因为它没有 proj4string
?
Simple feature collection with 566 features and 5 fields
geometry type: POINT
dimension: XY
bbox: xmin: 3.5837 ymin: 50.86487 xmax: 7.120998 ymax: 53.44835
epsg (SRID): NA
proj4string: NA
如何设置与之前地图相同的投影,以便在其上绘制坐标点?
您可以使用 st_crs
。
正如示例中所说:
st_crs(x) <- value
你的情况可能是
st_crs(points) <- st_crs(polygons)
注:当然要在同一个坐标系中配准点。如果不是,则必须为它们找到正确的坐标系,然后使用 st_transform
将它们放入与多边形相同的坐标系中。
另外还有函数st_set_crs()
,可以在管道中使用。例如,
points %>% st_set_crs(st_crs(polygons))
我正在尝试为我的 sf
对象定义正确的 CRS。我想在下一层(国家:荷兰)上绘制点:
Simple feature collection with 380 features and 3 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 13565.4 ymin: 306846.2 xmax: 278026.1 ymax: 619232.6
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
输出:
这一层有正确的投影。
但是 POINT
层没有正确的 CRS 项目,大概是因为它没有 proj4string
?
Simple feature collection with 566 features and 5 fields
geometry type: POINT
dimension: XY
bbox: xmin: 3.5837 ymin: 50.86487 xmax: 7.120998 ymax: 53.44835
epsg (SRID): NA
proj4string: NA
如何设置与之前地图相同的投影,以便在其上绘制坐标点?
您可以使用 st_crs
。
正如示例中所说:
st_crs(x) <- value
你的情况可能是
st_crs(points) <- st_crs(polygons)
注:当然要在同一个坐标系中配准点。如果不是,则必须为它们找到正确的坐标系,然后使用 st_transform
将它们放入与多边形相同的坐标系中。
另外还有函数st_set_crs()
,可以在管道中使用。例如,
points %>% st_set_crs(st_crs(polygons))