DeloitteOptimalReality / LightOSM.jl

A Julia package for downloading and analysing geospatial data from OpenStreetMap APIs.
https://deloitteoptimalreality.github.io/LightOSM.jl/docs
Other
48 stars 13 forks source link

Identify start and end nodes of a `Way{Int64}` #54

Open fbanning opened 2 years ago

fbanning commented 2 years ago

Say I want to look at a specific w::Way{Int64}. I can access w.nodes and get a vector of nodes that the way is made up of. I wonder if there is a way to identify the start and end node of a given Way{Int64}?

hs-ye commented 2 years ago

The w.nodes are in order (as they appear in the original .osm data), so you can just access the start and end of the way using w.nodes[1] and w.node[end]

mmiller-max commented 2 years ago

I think it's not quite as straight forward as that for determining the start and end though.

For a two-way way then yes you can just take the order of way.nodes and the reverse order to get the two lists of nodes. For a one-way there I think you need to check a tag to know which is the start - sorry I'm away from the computer so can't check this at the moment.

Perhaps we could provide an API for getting the start and end mode of a one way way?