简体   繁体   English

将地理多边形拆分为特定区域的多个多边形

[英]Splitting a geo polygon into multiple polygons of specific area

I am trying to split a polygon on R into multiple polygons of equal areas. 我正在尝试将R上的一个多边形拆分为相等面积的多个多边形。

I have the boundaries of the polygon which I need to split in boxes measuring 1km by 1km using R. I was wondering if this is possible using R. 我有多边形的边界,需要使用R将其分割为1km x 1km的盒子。我想知道使用R是否可以做到这一点。

For example: 例如:

x <- extent(c(40.97453103, 41.06321504, -92.47427103, -92.36617044))
plot(x)

This creates a box with the given bounds. 这将创建一个具有给定边界的框。 I am trying to create multiple boxes within the bounds of size 1km by 1km and then merge it on google maps using ggmap. 我正在尝试在尺寸为1km x 1km的范围内创建多个框,然后使用ggmap将其合并到Google地图上。

You can use the st_make_grid function from the sf package but we don't know your coordinates reference system and the units used. 您可以使用sf包中的st_make_grid函数,但我们不知道您的坐标参考系统和使用的单位。 Here is an example with grids of an arbitrary size : 这是一个具有任意大小的网格的示例:

library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2
x <- cbind(c(40.97453103, 41.06321504, 41.06321504, 40.97453103, 40.97453103),
           c(-92.47427103, -92.47427103, -92.36617044, -92.36617044, -92.47427103))

x <- st_sf(st_sfc(st_polygon(list(x))))
grid <- st_make_grid(x, cellsize = c(0.01,0.01))

par(mar = c(1,1,1,1))
plot(x)
plot(grid, add = T)

Created on 2018-02-25 by the reprex package (v0.2.0). reprex软件包 (v0.2.0)创建于2018-02-25。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM