Closed agila5 closed 2 months ago
Thanks @agila5, a PR would indeed be great! Note in preparation for that that sf
is not directly used at all, except in the dodgr_to_sf()
conversion function. I'd prefer to avoid depending on it for the central functions if at all possible, so trying to do this without direct sf
usage would be appreciated. Since you're only interested in distinguishing sf
types, that should be fairly easy, and those can be obtained directly from the attributes.
Update: You could easily put code here:
https://github.com/UrbanAnalyst/dodgr/blob/ac1eec58a947eab2c89fb04a600b8417ec6f3460/R/weight-streetnet.R#L238-L239
right before the call to rcpp_sf_as_network
. Something like this should do:
geom_types <- lapply (x$geometry, class)
And then filter out anything that's not a LINESTRING
.
Hallo again @mpadge! I'm creating this issue to highlight the following slightly problematic behaviour:
Created on 2024-09-23 with reprex v2.0.2
I'm not sure if it's possible to adjust the behaviour behind
weight_streetnet()
to subset onlyLINESTRING
geometries but, IMO, this type of interaction deserves a slightly more informative error message. Happy to create a PR if you agree.