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

weight/distance return on non standard crs #51

Closed hayden-t closed 5 years ago

hayden-t commented 5 years ago

Hi, got your library working but im using leaflet in simple crs mode with the coords just being the pixels of my map (no projection, just hanging in space) (its for a game)

The weight/distance returned seems to be hard coded for spherical ?

How would i go about getting a usable value ?

for example my image / crs is 1024 wide and 888 high, if i path a line from top to bottom, the weight is 18680.77347923352 if i do a path from left to right , the weight is 3906.0551639612486

hayden-t commented 5 years ago

So by using your weight function in the readme it fixes it, you should add in the readme that using a custom weight formula also overrides the distance calculation returned.

perliedman commented 5 years ago

Hi, changed the wording slightly. To be fair, from what I can tell the docs already says it's the total weight returned - the property's name is even weight, not distance.