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")