- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何获取 polys
中每个多边形的 bbox
?
pp <- cbind(coordinates(polys),as.data.frame(polys))
只给我 lonlat,但我想为每个多边形获取 lat1lat2
和 lon1lon2
。
polys=new("SpatialPolygonsDataFrame"
, data = structure(list(NAMRB_EN = structure(c(6L, 45L, 2L, 41L, 31L,
3L, 40L, 14L, 42L, 7L, 26L, 12L, 38L, 25L, 36L, 9L, 39L, 27L,
32L, 19L, 43L, 21L, 15L, 22L, 20L, 9L, 17L, 11L, 33L, 44L, 37L,
13L, 8L, 5L, 18L, 30L, 16L, 10L, 1L, 29L, 34L, 23L, 24L, 28L,
4L, 35L), .Label = c("Albany", "Arctic Ocean Seaboard", "Arnaud",
"Atlantic Ocean Seaboard", "Attawapiskat", "Back", "Baleine",
"Broadback", "Churchill", "Columbia", "Eastmain", "Feuilles",
"Fraser", "George", "Grande Baleine", "Harricanaw", "Hayes",
"Hudson Bay Seaboard", "Koksoak", "La Grande", "Little Mecatina",
"Mackenzie", "Mississippi", "Moose", "Naskaupi", "Nass", "Natashquan",
"Nelson", "Nottaway", "Pacific Ocean Seaboard", "Povungnituk",
"Romaine", "Rupert", "Saint John", "Saint Lawrence", "Seal",
"Severn", "Skeena", "St.-Augustin", "Stikine", "Taku", "Thelon",
"Wannock", "Winisk", "Yukon"), class = "factor"), NAODA_EN = structure(c(1L,
5L, 1L, 5L, 4L, 4L, 5L, 4L, 4L, 4L, 5L, 4L, 5L, 2L, 4L, 2L, 2L,
2L, 2L, 4L, 5L, 2L, 4L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 4L,
4L, 4L, 5L, 4L, 5L, 4L, 4L, 2L, 3L, 4L, 4L, 2L, 2L), .Label = c("Arctic Ocean",
"Atlantic Ocean", "Gulf of Mexico", "Hudson Bay", "Pacific Ocean"
), class = "factor"), NAMRB_FR = structure(c(4L, 45L, 19L, 41L,
31L, 2L, 40L, 12L, 42L, 5L, 27L, 10L, 38L, 26L, 36L, 7L, 39L,
28L, 32L, 16L, 43L, 18L, 13L, 23L, 17L, 7L, 15L, 9L, 33L, 44L,
37L, 11L, 6L, 3L, 22L, 21L, 14L, 8L, 1L, 30L, 34L, 24L, 25L,
29L, 20L, 35L), .Label = c("Albany", "Arnaud", "Attawapiskat",
"Back", "Baleine", "Broadback", "Churchill", "Columbia", "Eastmain",
"Feuilles", "Fraser", "George", "Grande Baleine", "Harricanaw",
"Hayes", "Koksoak", "La Grande", "Little Mecatina", "Littoral de l'océan Arctique",
"Littoral de l'océan Atlantique", "Littoral de l'océan Pacifique",
"Littoral de la Baie d'Hudson", "Mackenzie", "Mississippi", "Moose",
"Naskaupi", "Nass", "Natashquan", "Nelson", "Nottaway", "Povungnituk",
"Romaine", "Rupert", "Saint-Jean", "Saint-Laurent", "Seal", "Severn",
"Skeena", "St.-Augustin", "Stikine", "Taku", "Thelon", "Wannock",
"Winisk", "Yukon"), class = "factor"), NAODA_FR = structure(c(3L,
5L, 3L, 5L, 1L, 1L, 5L, 1L, 1L, 1L, 5L, 1L, 5L, 4L, 1L, 4L, 4L,
4L, 4L, 1L, 5L, 4L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 1L,
1L, 1L, 5L, 1L, 5L, 1L, 1L, 4L, 2L, 1L, 1L, 4L, 4L), .Label = c("Baie d'Hudson",
"Golfe de Mexique", "Océan Arctique", "Océan Atlantique", "Océan Pacifique"
), class = "factor")), .Names = c("NAMRB_EN", "NAODA_EN", "NAMRB_FR",
"NAODA_FR"), row.names = 0:45, class = "data.frame")
, polygons = list(<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>,
<S4 object of class structure("Polygons", package = "sp")>)
, plotOrder = c(3L, 24L, 35L, 46L, 44L, 2L, 42L, 38L, 45L, 36L, 26L, 9L, 32L,
1L, 20L, 39L, 27L, 31L, 43L, 25L, 16L, 7L, 30L, 40L, 6L, 15L,
34L, 13L, 12L, 41L, 28L, 8L, 23L, 29L, 5L, 10L, 37L, 11L, 14L,
33L, 4L, 22L, 18L, 19L, 17L, 21L)
, bbox = structure(c(-152.812332679775, 40.3769750107632, -52.6362915039062,
83.1106262207029), .Dim = c(2L, 2L), .Dimnames = list(c("x",
"y"), c("min", "max")))
, proj4string = new("CRS"
, projargs = "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"
)
)
最佳答案
空间多边形数据框有几个槽。 @data
是数据框,@polygons
是多边形。你可以先试试 str(polys@polygons)
看看你得到了什么。如果它是一个多边形列表,那么 lapply
它与 sp::bbox
函数
require(sp)
lapply(polys@polygons, bbox)
关于r - SpatialPolygonsDataFrame R中每个多边形的边界框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43264693/
不打算编辑拓扑,只是将所有多边形聚合到一个类型为 SpatialPolygonsDataFrame (spdf) 的 sp 对象中。每个 spdf 只有一个多边形。 数据(dropbox link t
我希望通过属性对 SpatialPolygonsDataFrame 进行子集化,但我希望允许它返回一个空的 SpatialPolygonsDataFrame。 如果我们将 SpatialPolygon
只有我有从 SpatialPolygonsDataFrame 中提取多边形坐标的问题吗?目的?我能够提取对象的其他插槽( ID , plotOrder )但不能提取坐标( coords )。我不知道我
我有一个 SpatialPolygonsDataFrame我通过使用 readOGR 读取 shapefile 创建的在 rgdal包裹。我正在尝试使用它来使用 spsample 生成采样网格在 sp
我有两个 SpatialPolygonsDataFrame文件:dat1、dat2 extent(dat1) class : Extent xmin : -180 xmax
如何获取 polys 中每个多边形的 bbox? pp , , , , , , , ,
使用可用的 shapefile here我正在尝试合并苏丹和南苏丹的多边形,以便在 2010 年获得苏丹的边界。我在 R 中提供 shapefile 的代码是 library(rgdal) afric
我想合并一个 SpatialPolygonsDataFrame : # From https://www.census.gov/geo/maps-data/data/cbf/cbf_state.htm
我想使用 leafletR::leaflet 创建分区统计图。我的数据位于 SpatialPolygonsDataFrame 中,我想选择要绘制的特定列。 使用 sp::spplot,这很容易,因为参
我有一个使用以下命令绘制的 SpatialPolygonsDataFrame: spplot(milanoNILNew, "percPolVita",at = c(0,0.0696,0.08979,0
我正在尝试做与这个问题相同的事情,Cartogram + choropleth map in R ,但从 SpatialPolygonsDataFrame 开始并希望以相同类型的对象结束。 我可以将对
当我有一个 SpatialPolygonsDataFrame 对象时,我知道我可以通过两种方式获取数据: spatial_df@data$column spatial_df$column 但是我不明白
我正在寻找一种从 SpatialPolygons 列表创建 SpatialPolygonsDataFrame 的方法? 下面是一个多边形列表示例,应从中创建包含列表中所有多边形的 SpatialPol
我有一堆我在县级绘制的数据,without borders .我想添加州界。我有一个状态 shapefile(多边形),但是 spplot似乎没有任何方法可以添加到之前的 map 之上。有没有办法在不
使用另一个可能复杂的 SpatialPolygon 在 R 中保留 @data 来裁剪(剪辑)复杂的 SpatialPolygonsDataFrame 的最快方法是什么?我知道两种方法(如下所示)。
我想知道是否可以做到这一点 R 。 我有一个数据作为SpatialLinesDataFrame,另一个数据作为spatialPolygonDataFrame。是否可以叠加这两个数据? 当我尝试覆盖这些
我有一个西类牙北部城镇的形状文件,我必须加入组(西类牙语中的自治市或 comarcas)。我已经使用 sf 包中的 st_union 成功加入了它们(每个都是它们自己的具有单个多边形的 Spatial
以下是用于重现目的的数据: structure(list(countyfp10 = c(1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7), id =
说我有两组形状文件覆盖同一区域,并且经常但不总是共享边界,例如美国县和 PUMA。我想定义一个新的多边形比例,它使用 PUMA 和县作为原子构建块,即两者都不能被拆分,但我仍然希望尽可能多的单位。这是
背景 我对使用 gSimplify 简化多边形很感兴趣。功能可通过 rgeos 获得包裹。 可重现的例子 可以使用以下代码生成可重现的示例: # Data sourcing -------------
我是一名优秀的程序员,十分优秀!