Попробуйте, хотя вы должны быть осторожны с единицами проекции. Поскольку вы не предоставили дополнительные данные, я использовал собственный пример. По сути, ответом является создание bbox
вокруг вашей точки с желаемыми размерами:
library(sf)
#> Warning: package 'sf' was built under R version 3.6.3
#> Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3
nc <- st_read(system.file("shape/nc.shp", package = "sf"))[1,]
#> Reading layer `nc' from data source `C:\Users\q31407\Documents\R\win-library\3.6\sf\shape\nc.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 100 features and 14 fields
#> geometry type: MULTIPOLYGON
#> dimension: XY
#> bbox: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
#> epsg (SRID): 4267
#> proj4string: +proj=longlat +datum=NAD27 +no_defs
# Project to get coods in "m", example 3857, could be any
nc <- st_geometry(st_transform(nc,3857))
point <- st_centroid(nc)
point
#> Geometry set for 1 feature
#> geometry type: POINT
#> dimension: XY
#> bbox: xmin: -9072327 ymin: 4360181 xmax: -9072327 ymax: 4360181
#> 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
#> POINT (-9072327 4360181)
#Important: coordinates in m, adjust the units on function
# Helper funct
rect_around_point <- function(x,xsize,ysize){
bbox <- st_bbox(x)
bbox <- bbox +c(xsize/2,ysize/2,-xsize/2,-ysize/2)
return(st_as_sfc(bbox))
}
rect <- rect_around_point(point,10000,20000)
rect
#> Geometry set for 1 feature
#> geometry type: POLYGON
#> dimension: XY
#> bbox: xmin: -9077327 ymin: 4350181 xmax: -9067327 ymax: 4370181
#> 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
#> POLYGON ((-9067327 4370181, -9077327 4370181, -...
plot(rect, axes=TRUE)
plot(point, add=TRUE)
![enter image description here](https://i.stack.imgur.com/W1xtZ.png)
Создано в 2020- 03-20 представьте пакет (v0.3.0)