geoknifewith a custom webgeom and/or webdata
Sciencebase WFS is offline at this time and this vignette will not be built.
This vignette shows how to use a custom Web Feature Service with
geoknife. In this case, we are using a WFS from ScienceBase.
The url used for the WFS can be found in the “Spatial Services” section
of the sciencebase item. If the WFS url you have has parameters
included, remove them when passing them to
For advanced users, it may be interesting to see what
geoknife is doing behind the scences. Switch
verbose=TRUE to see the web
service request being made when you execute this vignette.
gconfig(verbose=FALSE) <- webgeom(url="https://www.sciencebase.gov/catalogMaps/mapping/ows/5b68e7e3e4b006a11f75c06a") stencil <- query(stencil, 'geoms') stencil_geoms print(stencil_geoms)
Now we can select a WFS geometry layer (
geom) and query
for its attributes.
geom(stencil) <- stencil_geoms <- query(stencil, 'attributes') stencil_attributes print(stencil_attributes)
Now we can select an attribute and query for the values of that attribute. For this demo, we won’t set the values, but rather just move forward using all polygons in this geom
attribute(stencil) <- stencil_attributes print(query(stencil, 'values'))
Now we’ll set up our webdata with an OPeNDAP service as its url. Note
that this can be any OPeNDAP service compatible with
geoknife and the Geo Data Portal. What datasets are
compatible is beyond the scope of this vignette. The OPeNDAP dataset
used here is from the main USGS
THREDDS archive and is one included in
many other OPeNDAP datasets could be used by entering their OPeNDAP
service base URL in the same way.
<- webdata(url = 'https://cida.usgs.gov/thredds/dodsC/prism_v2', fabric variables = c('tmx', 'tmn', 'ppt'), times = as.POSIXct(c('2000-01-01', '2010-01-01'))) print(fabric)
Note that if you don’t know the valid variables and times for an
OPeNDAP URL, you can use
query to find them like this.
<- query(fabric, "variables") fabric_variables <- query(fabric, "times") fabric_times print(paste(fabric@url, "has", paste(fabric_variables, collapse = ", "), "variables for the time range", fabric_times, "to", fabric_times))
Now we can execute the
geoknife job for the specified
fabric and stencil. Note that we set
wait = TRUE here so we
can just wait for the result of the process.
<- result(geoknife(stencil, fabric, wait = TRUE))prism_yahara_result