Skip to contents

This function creates and processes spatial layers for divides, flow paths, and sites that intersect with divides. It reads spatial data from a GeoPackage and performs spatial operations such as intersection and joining.

Usage

CleanSites(x)

Arguments

x

A simple features (SF) object representing site locations.

Value

This function does not return a value. Instead, it assigns three spatial layers to the global environment:

  • `NewDivides`: A simple features (SF) object representing divides, transformed to CRS EPSG:4269.

  • `dangermond_sites`: The intersection of the provided site locations with the divides.

  • `dangermond_sites`: The result of joining `dangermond_sites` with `NewDivides`.

Details

The `CleanSites` function performs the following steps:

  • Reads spatial data from the `nextgen_hydorfabric.gpkg` GeoPackage, specifically the `divides` layer.

  • Transforms the CRS of the `divides` layer to EPSG:4269 and stores it in a variable `NewDivides`.

  • Computes the intersection of the input site data (`x`) with `NewDivides` and stores the result in `dangermond_sites`.

  • Joins the intersected sites (`dangermond_sites`) with `NewDivides` and updates the `dangermond_sites` variable.