Closed trandinh135 closed 7 years ago
Hi @trandinh135, sorry to hear this isn't working out for you. However, I have a hard time understanding the actual problem here. Ideally, provide a running example of what you're trying to do, or at least provide a dataset (GeoJSON network) that illustrates the problem.
Without seeing more, it's really hard to tell what the problem might be.
I solved its by call turf-nearest to get nearest point from myPoints to allPoint before call findPath. You can try with my data(build in nodejs server) ,path data from path.json , two points from points.json path_points.zip.txt
Hi !. @perliedman , facing the same problem as above. Here is my dataset attached. Please illustrate me with an example as i am a newbie to Node JS. Start Point : [ 83.314542527576918, 17.72899666265652 ] Finish Point : [ 83.314348474550883, 17.728957487757825 ]
@Rishi341 a common problem, as hinted by @trandinh135, is that you attempt to pass start
or finish
coordinates that are not part of the routing network.
You can use for example turf-nearest
to find the closest point in the network, and the pass that as start
or finish
, that is what the demo does.
@perliedman ,facing same problem as posted by @Rishi341 and @trandinh135 . I have installed turf-nearest npm and given a try , but in vain. It would be better if you can please share the logic with an example.
@s9eenk
var explode = require('turf-explode');
var nearest = require('turf-nearest');
var PathFinder = require('geojson-path-finder');
var pathFinder = new PathFinder(geojson);
var points = explode(geojson);
var start = point(...);
var end = point(...);
var startInNetwork = nearest(start, points);
var endInNetwork = nearest(end, points);
var path = pathFinder.findPath(startInNetwork, endInNetwork);
Superb !. . . .Saved my day. Perfect
I had a linestring layer and a point layer on the same map area. I replace my linestring to your demo, it work with any position of marker. Then I build node js server. I find path between two points in my point layer. Its not working at all Simply: my points 111.01234567891011, 11.01234567891011 - 222.01234567891011, 22.01234567891011 if change any number after 5 or 6 it work, before not. I try change _precision e-5 to e-2. it work but points of path result aren't serial