# \donttest{
# 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")
# }
Run the code above in your browser using DataLab