How to plot a marker away from another marker by 100 metres in Mapbox Leaflet? -
i trying plot marker using leaflet , marker away the first 1 100 metres. plotting marker easy:
var marker = l.marker([0, 0]).addto(map);
but how plot marker away 1 100 metres? there way convert metres long , lat , plotting it? or there better way not aware of?
i've forked fiddle show example. it's based on these answers:
https://gis.stackexchange.com/questions/25877/how-to-generate-random-locations-nearby-my-location
var r = 100/111300 // = 100 meters , y0 = original_lat , x0 = original_lng , u = math.random() , v = math.random() , w = r * math.sqrt(u) , t = 2 * math.pi * v , x = w * math.cos(t) , y1 = w * math.sin(t) , x1 = x / math.cos(y0) newy = y0 + y1 newx = x0 + x1
Comments
Post a Comment