Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for MULTILINESTRING #16

Open
temospena opened this issue Nov 3, 2020 · 5 comments
Open

support for MULTILINESTRING #16

temospena opened this issue Nov 3, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@temospena
Copy link
Collaborator

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.

@temospena temospena added the enhancement New feature or request label Nov 3, 2020
@Robinlovelace
Copy link
Member

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,

@temospena
Copy link
Collaborator Author

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
SplitLines_nodes

after rnet_breakup_vertices()
SplitLines_nodes_stplanr
A highway under the bridge
SplitLines_nodes_stplanrBridge
A freeway node
SplitLines_nodes_stplanrBridge2

@Robinlovelace
Copy link
Member

Robinlovelace commented Nov 5, 2020

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!

@temospena
Copy link
Collaborator Author

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?

@Robinlovelace
Copy link
Member

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: f4b186b#diff-c740135a485a4e9106eb0498a31506a4fab102277b04319fe00947772303e70aR108-R110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants