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

Trail Network #53

Open
kylebarron opened this issue Feb 3, 2020 · 1 comment
Open

Trail Network #53

kylebarron opened this issue Feb 3, 2020 · 1 comment

Comments

@kylebarron
Copy link
Member

Create a topologically-connected trail network

Outline

  1. Get approximate trail geometry from any source. Say Halfmile or even USFS for the PCT, etc for other trails.
  2. Using the approximate trail geometry, download all trails from OSM for an n-mile buffer around the trail. I now have an OSM network of trails, which are generally well-connected. (You could have a validating function here that searches for trails that are very close or intersecting but don't have an intersecting node).
  3. Have a validating function that finds areas of the two tracks that are far from each other. Say for every point on the OSM track of the given line, find the closest point on the Halfmile/other track and record where the tracks are >100m apart from each other.
  4. Validate that the OSM trail relation is well-connected, i.e. that every way of every part of the relation is connected to the one before and after, so that there are no gaps.
  5. Find trail junctions
  6. Find water intersections.
  7. If you wish to use the Halfmile data as the main data source in the app, then you need to figure out a way to take the OSM network of trails and adjust everything for use with the original HM track.
  8. Validate that final network of trails is connected.

When running Tippecanoe, you need to make sure you use --no-simplification-of-shared-nodes so that lines share a node. Then you can probably have simple routing using the vector tiles.

Notes:

  • If you want to also generate trail junctions on alternates, then you need the OSM track of those alternates.
  • How long is the OSM track actually?

Uses

  • Pass to water code to find streams, lakes, and springs that are on or near the main trail or a side trail. For this you want to use OSM data so that you have every trail near the PCT.
  • Find trail junctions. I need to use the OSM track of the PCT to find trail junctions because intersecting the Halfmile track with the OSM track would generate tons of spurious trail junctions between the two versions of the PCT.
  • Generate logical trail segments that you can show mile markers of on the map.

Ref: #45, #46, #41, #5, #4

@kylebarron
Copy link
Member Author

As of 452a299
I have the approx trail geometry, and have code to make networkx graphs much more quickly by using geofabrik extracts.

For finding trail junctions, you can just iterate over nodes that have _trail=True, and very quickly do G.edges(node_id, data=True) to see the metadata of the edges that connect to that node.

For finding water intersections, you'll probably want to check out something like
get_nearest_edges for springs.
https://osmnx.readthedocs.io/en/stable/osmnx.html#osmnx.geo_utils.get_nearest_edges

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

No branches or pull requests

1 participant