vstar1411 / leaflet_assignment

0 stars 0 forks source link

Regarding calculating distance #3

Open vstar1411 opened 7 months ago

vstar1411 commented 7 months ago

for Distance calculation method (Refer calculateDistance method in src/utils/PointsOnMap.js )

var scale = Math.pow(2, (_this.maxNativeZoom - this._map.getZoom()));
start_x *= scale;
start_y *= scale;
end_x *= scale;
end_y *= scale;
distance = math.sqrt((start_x - end_x) ** 2 + (end_x - end_y) ** 2) * mpp

I have changed the last line to distance = math.sqrt((start_x - end_x) ** 2 + (start_y - end_y) ** 2) * mpp

Thinking there was a typo end_x instead of start_y . Please correct me if I am wrong.

sanosano commented 7 months ago

@vstar1411 Yes, you are right.