r 从空间对象中提取坐标的方法(例如SpatialPolygonsDataFrame)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r 从空间对象中提取坐标的方法(例如SpatialPolygonsDataFrame)相关的知识,希望对你有一定的参考价值。

# Ben Fasoli

library(sp)
library(rgdal)

shape <- readOGR(dsn = 'data', layer = 'four_samples')

head(shape@polygons[[1]]@Polygons[[1]]@coords)
#           [,1]     [,2]
# [1,] -111.6227 40.75247
# [2,] -111.6227 40.75243
# [3,] -111.6226 40.75185
# [4,] -111.6224 40.75108
# [5,] -111.6224 40.75105
# [6,] -111.6221 40.75080

head(raster::geom(shape))
#      object part cump hole         x        y
# [1,]      1    1    1    0 -111.6227 40.75247
# [2,]      1    1    1    0 -111.6227 40.75243
# [3,]      1    1    1    0 -111.6226 40.75185
# [4,]      1    1    1    0 -111.6224 40.75108
# [5,]      1    1    1    0 -111.6224 40.75105
# [6,]      1    1    1    0 -111.6221 40.75080

head(ggplot2::fortify(shape))
#        long      lat order  hole piece id group
# 1 -111.6227 40.75247     1 FALSE     1 25  25.1
# 2 -111.6227 40.75243     2 FALSE     1 25  25.1
# 3 -111.6226 40.75185     3 FALSE     1 25  25.1
# 4 -111.6224 40.75108     4 FALSE     1 25  25.1
# 5 -111.6224 40.75105     5 FALSE     1 25  25.1
# 6 -111.6221 40.75080     6 FALSE     1 25  25.1

以上是关于r 从空间对象中提取坐标的方法(例如SpatialPolygonsDataFrame)的主要内容,如果未能解决你的问题,请参考以下文章

如何使用坐标和 R 中 shapefile 中的另一个值从栅格中提取值?

微软Hololens学院教程-Hologram 230-空间映射(Spatial mapping )

关于Oracle Spatial的数据格式 C#

数字图像处理:线性和非线性滤波的平滑空间滤波器(Smoothing Spatial Filters)

论文笔记:Spatial-Temporal Map Vehicle Trajectory Detection Using Dynamic Mode Decomposition and Res-UNe

怎么从Auto CAD中提取多段线坐标?