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

add findNearestJunction() method to find the nearest junction vertex to a given point #65

Closed nickw1 closed 1 year ago

nickw1 commented 4 years ago

This pull request is from a separate branch 'junctionfinder' of my fork of geojson-path-finder. It's independent to #64.

It adds the functionality to find the nearest 'junction vertex' of the graph to a given point, This is useful if, for any reason, you need to 'snap' a point to a junction vertex. I have defined junction vertices as either those with three or more edges, or, conversely, those with just one edge, which are also likely to be potentially interesting.

I use this functionality for two separate use-cases, so thought it might be useful to add to GeoJSON Path Finder.

The first use-case is a panorama application, in which 360 panoramas are connected by GeoJSON Path Finder-derived routes; snapping panoramas to the nearest junction (if the panorama is very close to a junction) will mean that it will be linked correctly to all adjacent panoramas. The other is an augmented reality application in which I need to detect the location of path junctions so that I can create virtual signposts to nearby points of interest (again using GeoJSON Path Finder to route to those POIs).

nwcourses commented 1 year ago

@perliedman This can be closed I think, as it's not core functionality and best done via a separate library.

nickw1 commented 1 year ago

Closed, as it's not core functionality and best done via a separate library. Oops, sorry, had logged in with my other account.