R语言【GIFT】——GIFT_spatial():GIFT清单的空间选择

本文档介绍了GIFT_spatial函数,一个用于检索与Shapefile或自定义坐标集重叠的GIFT检查表的工具。它接受多个参数如Shapefile、坐标、重叠标准等,并返回包含实体ID、几何实体引用和覆盖百分比的数据帧。提供了使用不同输入(如Shapefile、点、边界框和自定义多边形)的示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Package GIFT version 1.3.2


Description

检索与形状文件或一组坐标重叠的检查表。


Usage

GIFT_spatial(
  shp = NULL,
  coordinates = NULL,
  overlap = "centroid_inside",
  entity_ID = NULL,
  GIFT_version = "latest",
  api = "https://gift.uni-goettingen.de/api/extended/"
)

Arguments

参数【shp】:由用户提供的Shapefile。其坐标参考系统(CRS)必须设置为WGS84 (EPSG代码4326)。

参数【coordinates】:自定义坐标集。格式是两列,第一列是经度,第二列是纬度。如果给出了4个坐标,则该函数假定这些坐标是边界框的四个角。

参数【overlap】:一个字符串,定义检索检查列表时要使用的标准。可用的选项是centroid_inside, extent_intersect, shape_intersect和shape_inside。例如,extent_intersect意味着将检索到GIFT中与所提供形状/坐标相交的每个多边形。

参数【entity_ID】:约束由预定义的entity_id集合接收的区域列表。例如,这个列表可以来自GIFT_checklists_conditional()。

参数【GIFT_version】:定义要使用的GIFT数据库版本的字符串。该函数默认检索最新的稳定版本。如果设置为测试版,则使用最新的版本,该版本仍然可以进行更改和编辑。

参数【api】:定义从哪个API检索数据的字符串。


Value

包含3列的数据帧:entity_ID多边形的标识号,geo_entity_ref其名称,coverage表示所提供的形状与GIFT的不同多边形之间的重叠百分比。


Example

# With a shapefile
data("western_mediterranean")
ex <- GIFT_spatial(shp = western_mediterranean, overlap = "centroid_inside")

# With a shapefile coming from GIFT
spain <- GIFT_shapes(entity_ID = 10071)
ex_spain <- GIFT_spatial(shp = spain)

# With a point 
custom_point <- cbind(9.9, 51)
ex2 <- GIFT_spatial(coordinates = custom_point,
overlap = "extent_intersect")

# With an extent
custom_extent <- cbind(c(-13, -18), c(27.5, 29.3))
ex3 <- GIFT_spatial(coordinates = custom_extent,
overlap = "extent_intersect")

# With a custom polygon
custom_polygon <- cbind(c(-18, -16.9, -13, -13, -18, -18),
c(29.3, 33, 29.3, 27.5, 27.5, 29.3))
ex4 <- GIFT_spatial(coordinates = custom_polygon,
overlap = "extent_intersect")

#With a linestring
custom_linestring <- rbind(c(9.9, 51), c(2.35, 48.9))
custom_linestring <- sf::st_as_sf(as.data.frame(custom_linestring),
coords = c("V1", "V2"))
custom_linestring <- dplyr::summarise(custom_linestring,
geometry = sf::st_combine(geometry))
sf::st_crs(custom_linestring) <- sf::st_crs(western_mediterranean)
ex5 <- GIFT_spatial(shp = custom_linestring, overlap = "extent_intersect")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ALittleHigh

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值