SILOThiessenShp: Function to generate Thiessen polygons from SILO sites

View source: R/SILOThiessenShp.R

SILOThiessenShpR Documentation

Function to generate Thiessen polygons from SILO sites

Description

Function to generate Thiessen polygons from SILO sites

Usage

SILOThiessenShp(SILOdata, path, shpname, boundary = NULL)

Arguments

SILOdata

- data loaded from SILO based on site list

path

- file path to save Thiessen polygon shapefile

shpname

- filename to save ESRI shapefile (no extension)

boundary

- optional either a filename(including path) of a boundary, e.g. catchment boundary, to apply, or the boundary as a sfc_MULTIPOLYGON object

Value

A simple feature geometry (sf::sfc object) of the polgyons created. Shape file saved to path \ shpname

If boundary is specified weights are written to the attribute table of the polygon return, which can be extracted with st_drop_geometry(returnedfeature[c("Station","weights")])

Examples

 
## Not run: 
X<-SILOLoad(c("24001","24002","24003"),path="./SWTools/extdata")
p<-SILOThiessenShp(X,tempdir(),"Theissens")
a<-SILOSiteSummary(X)
ggplot(p)+geom_sf(aes(fill=AnnualRainfall))+
geom_point(data=a,aes(Longitude,Latitude))+
geom_text(data=a,aes(Longitude,Latitude,label=Site),nudge_y = 0.02)

## End(Not run)

SWTools documentation built on May 31, 2023, 6:24 p.m.