R 多多边形数据对象上的点投影问题

R 多多边形数据对象上的点投影问题,r,sf,map-projections,R,Sf,Map Projections,我正试图在一张多功能地图上绘制点数据(坐标)。但我无法让它们彼此重叠,保持正确的形状 荷兰的基本投影数据multipolygon数据: Simple feature collection with 1 feature and 3 fields geometry type: MULTIPOLYGON dimension: XY bbox: xmin: 13565.4 ymin: 306846.2 xmax: 278026.1 ymax: 619232.6 epsg

我正试图在一张多功能地图上绘制点数据(坐标)。但我无法让它们彼此重叠,保持正确的形状

荷兰的基本投影数据
multipolygon
数据:

Simple feature collection with 1 feature and 3 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 13565.4 ymin: 306846.2 xmax: 278026.1 ymax: 619232.6
epsg (SRID):    28992
proj4string:    +proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.4171,50.3319,465.5524,-0.398957,0.343988,-1.87740,4.0725 +units=m +no_defs
荷兰档案

基础
坐标投影数据:

Simple feature collection with 1466 features and 4 fields
    geometry type:  POINT
    dimension:      XY
    bbox:           xmin: 3.389737 ymin: 50.77106 xmax: 7.187327 ymax: 53.44402
    epsg (SRID):    28992
    proj4string:    +proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.4171,50.3319,465.5524,-0.398957,0.343988,-1.87740,4.0725 +units=m +no_defs
df
dataframe的某些行:

df <- structure(list(brouwerijnaam = c("Almelosche", "HertogJan", "HertogJan", 
"Bavaria", "Bavaria", "Brand"), begin_datum_jaar = c(1987, 1981, 
1981, 1719, 1719, 1340), eind_datum_jaar = c(1990, 0, 0, 0, 0, 
0), plaats = c("Almelo", "Arcen", "Arcen", "Lieshout", "Lieshout", 
"Wijlre"), lon = c(52.35192, 51.473427, 51.473427, 51.518607, 
51.518607, 50.832695), lat = c(6.660562, 6.181219, 6.181219, 
5.597416, 5.597416, 5.895593)), row.names = c(NA, -6L), class = c("tbl_df", 
"tbl", "data.frame"))
points <- structure(list(brouwerijnaam = c("Almelosche", "HertogJan", "HertogJan", 
"Bavaria", "Bavaria", "Brand"), begin_datum_jaar = c(1987, 1981, 
1981, 1719, 1719, 1340), eind_datum_jaar = c(1990, 0, 0, 0, 0, 
0), plaats = c("Almelo", "Arcen", "Arcen", "Lieshout", "Lieshout", 
"Wijlre"), geometry = structure(list(structure(c(52.35192, 6.660562
), class = c("XY", "POINT", "sfg")), structure(c(51.473427, 6.181219
), class = c("XY", "POINT", "sfg")), structure(c(51.473427, 6.181219
), class = c("XY", "POINT", "sfg")), structure(c(51.518607, 5.597416
), class = c("XY", "POINT", "sfg")), structure(c(51.518607, 5.597416
), class = c("XY", "POINT", "sfg")), structure(c(50.832695, 5.895593
), class = c("XY", "POINT", "sfg"))), class = c("sfc_POINT", 
"sfc"), precision = 0, bbox = structure(c(xmin = 50.832695, ymin = 5.597416, 
xmax = 52.35192, ymax = 6.660562), class = "bbox"), crs = structure(list(
    epsg = NA_integer_, proj4string = NA_character_), class = "crs"), n_empty = 0L)), row.names = c(NA, 
-6L), sf_column = "geometry", agr = structure(c(brouwerijnaam = NA_integer_, 
begin_datum_jaar = NA_integer_, eind_datum_jaar = NA_integer_, 
plaats = NA_integer_), .Label = c("constant", "aggregate", "identity"
), class = "factor"), class = c("sf", "tbl_df", "tbl", "data.frame"
))
我使用的代码用于塑造sf对象中具有相同多多边形数据crs的x和y坐标

library(sf)
library(tidyverse)

points <- df %>%
  filter(!is.na(lon)) %>%
  st_as_sf(coords = c("lat", "lon")) 

points <- st_set_crs(brouwerijen_sf, 28992)

ggplot() +
  geom_sf(data = multipolygon) +
  geom_sf(data = points) +
  coord_sf(datum = NA)
库(sf)
图书馆(tidyverse)
点数%
过滤器(!is.na(lon))%>%
st_as_sf(坐标=c(“纬度”、“经度”))

点使用样本数据中的
df

points <- st_as_sf( df,
                    coords = c("lat", "lon"),
                    crs = 4326 )

nl <- st_read( "./2019_landsgrens_kustlijn.gpkg")

library(ggplot2)
ggplot() +
  geom_sf(data = nl) +
  geom_sf(data = points)

指出一些示例数据可能会有所帮助。。。。使用
dput()
提供一些,这样每个人都可以看到您正在使用的数据。谢谢我添加了一些数据。您也可以从
df
发布一些数据,而不是
@Wimpel我添加了请求的数据。很好,您如何知道我需要crs
4326
?crs 4326是WSG84纬度/经度坐标的“默认”crs。