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

Add fields to `OSMGraph` type: `index_to_way`, `sorted_edges` #60

Open fbanning opened 2 years ago

fbanning commented 2 years ago

I'm currently building a plotting package for LightOSM maps and in this process it has occurred to me that it would be handy to have one (possibly two) additional fields in the OSMGraph type.

  1. index_to_way: a dictionary which maps the index of an edge of the underlying OSMGraph.graph to the OSMGraph.Way it represents.
  2. sorted_edges: a vector whose indices correspond to OSMGraph.graph.edges and maps to the indices of its start and end nodes OSMGraph.graph.vertices. (This field could also be named edge_to_vertices or something like that.)

This is how I've currently implemented it for my needs: https://github.com/fbanning/OSMMakie.jl/blob/77052b22853f57e03d3712094075c46195d6f987/src/recipe.jl#L35-L46

I think that index_to_way could be very handy to be made available to all users as a field of the OSMGraph type. However, I'm not so sure about sorted_edges because it's solely concerned with the node and edge indices of the underlying graph and doesn't work with any OSM data at all.

Would like to hear your opinions on these extensions of OSMGraph. If you're feeling positive about it, would you accept a PR if I make one?