perliedman / geojson-path-finder

Find shortest path through a network of GeoJSON
https://www.liedman.net/geojson-path-finder/
ISC License
300 stars 86 forks source link

Likely fix of issue #27 #64

Closed nickw1 closed 3 years ago

nickw1 commented 4 years ago

This is a likely fix of issue #27, which works in my test case, OpenTrailView (https://opentrailview.org) which uses GeoJSON Path Finder to connect together panoramas using GeoJSON OpenStreetMap data.

The issue appears to be when a phantom node is created for the end point of a route. The compactedCoordinates from the previous 'real' node (the neighbor) to the phantom node should contain the previous 'real' node, and not the phantom node - but in fact contain the reverse.

This happens because the incomingCoordinates of the phantom from the neighbor contain the phantom, but not the neighbor.

So the fix creates the compactedCoordinates by obtaining the neighbor coordinates (the exact unrounded coordinates of the neighbor are obtained) and concatenating the incomingCoordinates with the last member (the phantom coordinates) removed.

nickw1 commented 3 years ago

Closed. Will reopen from issue-27-fix branch of my fork. Reason is that I am doing other updates on my master branch, and want to keep this PR clean.