I am working with leaflet plugins, calculating distance between two points of a polyline or whole distance of joint/multiple lines
Work :I set up the script to measure the distance in meters when using image as map...
Script
function showPolygonArea(e) { featureGroup.addLayer(e.layer); var tempLatLng = null; var totalDistance = 0.00000; $.each(e.layer._latlngs, function (i, latlng) { if (tempLatLng == null) { tempLatLng = latlng; return; } //transformation experiment totalDistance += tempLatLng.distanceTo(latlng); tempLatLng = latlng; userDistanceVal = totalDistance / 100000; }); e.layer.bindPopup((totalDistance / 100000).toFixed(2) + ' meters'); e.layer.openPopup();}Problem :
Any kind of reference or help will be appreciated..thanks for your time
أكثر...
Work :I set up the script to measure the distance in meters when using image as map...
Script
function showPolygonArea(e) { featureGroup.addLayer(e.layer); var tempLatLng = null; var totalDistance = 0.00000; $.each(e.layer._latlngs, function (i, latlng) { if (tempLatLng == null) { tempLatLng = latlng; return; } //transformation experiment totalDistance += tempLatLng.distanceTo(latlng); tempLatLng = latlng; userDistanceVal = totalDistance / 100000; }); e.layer.bindPopup((totalDistance / 100000).toFixed(2) + ' meters'); e.layer.openPopup();}Problem :
here (1) i want to return the totalDistance in pixels instead of meters ....
(2)and here, how can i use layerPoint or containerPoint functin? (as i am struggling about the usage understanding)
I have so little experience in javascript, if doing or asking something stupid, please ignore...If its possible to do that way, please help....(2)and here, how can i use layerPoint or containerPoint functin? (as i am struggling about the usage understanding)
Any kind of reference or help will be appreciated..thanks for your time
أكثر...