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

Issue 27 fix #70

Closed nickw1 closed 3 years ago

nickw1 commented 3 years ago

(Please note this is a new version of now-closed PR #64, now based on the issue-27-fix branch of my fork, as I wish to make other unrelated changes to master.)

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.

perliedman commented 3 years ago

Hi and thanks a lot for taking the time to dig into this and also for submitting a PR. Really sorry about taking so long before looking at it, but just so little time (or energy) for open source maintenance these days.

perliedman commented 3 years ago

I have published version 1.5.3 which includes this fix.

nickw1 commented 3 years ago

@perliedman many thanks! Let me know if you are anyone else encounter any problems.