New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not finding points. Always returning empty arry. #4
Comments
Can't really tell without context - can you link to an online example? |
Sure, here's the quick test/demo : http://labs.jamestindall.info/rhumb_lines/ and the js file is at : http://labs.jamestindall.info/rhumb_lines/js/main-using-leaflet.js (see function findClosestTrackPoint at line 83) |
Hmm, this code has the bit using leaflet-knn disabled/commented out in initialization, and unused anywhere else. |
Sorry to have taken up your time Tom, I was on a deadline and had to drop leaflet-knn in favour of using the leaflet.geometryutil plugin. |
Reopening to find the core issue. |
Ah, initialization flow was likely wrong. Closing; this was in the app. |
Interesting. What had I done wrong? |
The example was using polylines; this library deals in markers only. |
Thanks again for taking a look Tom. Though that really needs to be stated more clearly in the documentation. I followed the example and passed in GeoJSON. There should be very little difference whether the GeoJSON features are drawn as points/markers or as lines or polygons the method of calculating the nearest neighbour should be the same. |
Hi,
I've added a geoJSON layer to a leafletjs map by passing this json file ( http://labs.jamestindall.info/rhumb_lines/tracks.json )
to the
L.geoJson
method and this successfully generates the desired polylines.However, when I then pass a L.LatLng to leaflet-knn like so :
nearest is always an empty array no matter how high I set the max_distance threshold. Any ideas what might be going wrong here?
The text was updated successfully, but these errors were encountered: