getLayer | R Documentation |
Get a shapefile from a local folder, optionally crop it by a bounding box, and return it as a sf object getLayer is used within TADA_addPolys and TADA_addPoints
getLayer(layerfilepath, bbox = NULL)
layerfilepath |
Local path to the .shp file for the layer |
bbox |
A bounding box from the sf function st_bbox; used to filter the query results. Optional; defaults to NULL. |
sf object containing the layer
## Not run:
# Load example dataset
data(Data_6Tribes_5y_Harmonized)
# Get the bounding box of the data
bbox <- sf::st_bbox(
c(
xmin = min(Data_6Tribes_5y_Harmonized$TADA.LongitudeMeasure),
ymin = min(Data_6Tribes_5y_Harmonized$TADA.LatitudeMeasure),
xmax = max(Data_6Tribes_5y_Harmonized$TADA.LongitudeMeasure),
ymax = max(Data_6Tribes_5y_Harmonized$TADA.LatitudeMeasure)
),
crs = sf::st_crs(Data_6Tribes_5y_Harmonized)
)
# Get the American Indian Reservations feature layer,
# filtered by the bounding box for the Data_6Tribes_5y_Harmonized
# example dataset
layerfilepath <- "extdata/AmericanIndian.shp"
getLayer(layerfilepath, bbox)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.