2

I want to make a location tool in a leaflet web map.

In fact, I create a wep map application with Leaflet in which we can find those layers:

  • Bing aerial layer
  • POI = Points layer which contains geographical coordinates and kilometer point of a line
  • Lines = Polylines layer

My lines were built and calibrated with ArcGIS in ESRI shapes format but for the web application in Leaflet, I transformed this data in a GEOJSON Format. I don't have a server and GeoJSON is better for the vizualisation in Leaflet.

With those layers, I have to locate some kilometers point on the lines but those points are not in the POI layer. For that, I have to make a HTML Form where we put the kilometer point that we are looking for. And after, I want the tool gives us the position of this kilometer point on the line and zoom on it on the map.

For that, I found the Leaflet.GeometryUtil functions on Github (Interpolate on line and Locate On line by makina corpus) but I don't know how to use it and how can I make the link between the HTML Form and those javascript functions.

Here's an schematic picture of want I want to do :

html_form_treatment

Please, can you give me a little help ?

  • Someone ? Please ? – bp03 Jan 24 '17 at 8:38
  • Here's a partial answer. To get your form input into javascript, try something like this: document.getElementById('txt_name').value. More ideas, e.g. using jQuery, at this SO question. I also strongly recommend looking at the tutorials for Leaflet.GeometryUtil: tutorial-closest and tutorial-distance-length. – user2441511 Jan 26 '17 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.