Open temospena opened 3 years ago
Does the breakup_vertices()
function fix it? Will be good to test on an example dataset that has linestrings, e.g. a smaller version of the dataset tested in #12,
I tried the stplanr::rnet_breakup_vertices()
and it worked. It kept the bridges and tunnels intact and split where it should.
before breakup vertices
after rnet_breakup_vertices()
A highway under the bridge
A freeway node
Interesting. How about updating the error message
https://github.com/ITSLeeds/slopes/blob/3f71fa5b38af52e586fae4b67b1893159116f3d8/R/slopes.R#L257
So it says:
"Only works with LINESTRINGs. Try converting with sf::st_cast(object, 'LINESTRING'), e.g. with the `stplanr::rnet_breakup_vertices()` function, first"
?
Great to see a function useful for things beyond what it was originally developed for!
Actually, I applied rnet_breakup_vertices()
to the original osm network (as LINESTRINGS
).
The previous error message sounds good in any case, it warns that it won't work with MULTILINESTRING and suggest to use st_cast
.
We can add the tip to use stplanr
in a vignette to use slopes_raster()
with open data from OSM & NASA - and in that case, we won't need MULTILINESTRING. But maybe that's a too particular application?
OK, yes I think the tip could also go in the help file associated with slope_raster()
. I've just put in a PR that I think does that: https://github.com/ITSLeeds/slopes/pull/17/commits/f4b186be9aa0e26643ab37e9b07fc78b184f40d7#diff-c740135a485a4e9106eb0498a31506a4fab102277b04319fe00947772303e70aR108-R110
slope_raster()
works only with LINESTRING. Sometimes we don't want to break a street network in all the intersections (e.g. bridges, tunnels).network = st_cast(network, "LINESTRING", do_split=F)
does not quite do the trick.