Problem
fl_valley_confine() calls sf::st_buffer() internally for the channel_buffer feature (R/fl_valley_confine.R:202). When streams are pulled from fwapg (e.g., via fresh::frs_stream_fetch()), the geometries are XYZM — route measures live in M. GEOS rejects XYZM:
Error: GEOS does not support XYM or XYZM geometries; use st_zm() to drop M
Every caller pulling from fwapg has to remember to sf::st_zm(streams) before calling fl_valley_confine(). Surfaced during #34 work; for now the data-raw script (data-raw/wsg_vignette_data.R) has an explicit sf::st_zm() workaround.
fl_dem_aoi() was hardened the same way during #34 (drops Z/M internally before sf::st_buffer()).
Proposed Solution
One-line fix in fl_valley_confine(): drop Z/M at the top of the function once streams is identified as sf. Mirrors what fl_dem_aoi() does.
if (inherits(streams, "sf")) {
streams <- sf::st_zm(streams)
...
}
Also worth a test: pass an XYZM streams sf and assert it runs end-to-end without erroring.
References
Problem
fl_valley_confine()callssf::st_buffer()internally for thechannel_bufferfeature (R/fl_valley_confine.R:202). When streams are pulled from fwapg (e.g., viafresh::frs_stream_fetch()), the geometries are XYZM — route measures live in M. GEOS rejects XYZM:Every caller pulling from fwapg has to remember to
sf::st_zm(streams)before callingfl_valley_confine(). Surfaced during #34 work; for now the data-raw script (data-raw/wsg_vignette_data.R) has an explicitsf::st_zm()workaround.fl_dem_aoi()was hardened the same way during #34 (drops Z/M internally beforesf::st_buffer()).Proposed Solution
One-line fix in
fl_valley_confine(): drop Z/M at the top of the function oncestreamsis identified assf. Mirrors whatfl_dem_aoi()does.Also worth a test: pass an XYZM streams sf and assert it runs end-to-end without erroring.
References
sf::st_zm()in data-raw scriptfl_dem_aoi()during Add DEM source helpers (file, STAC) for AOI-driven workflows #34