开发者

how to put two marker at a distance of 500m in google map [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

how to put two marker at a distance of 500m in google map

I was wondering if anyone know how we can put two markers at a distance of 500 meter, lets say I put first marker at london(50,0) and second marker at some lo开发者_运维问答cation 500 meter away from london(50,0). how would it happen. I have been looking a lot for it but couldnt find any answer. Any suggestion would be appreciated


θ is the bearing (in radians, clockwise from north);
d/R is the angular distance (in radians), where d is the distance travelled and R is the earth’s radius

src: http://www.movable-type.co.uk/scripts/latlong.html

var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + 
                      Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1), 
                             Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));

Alternative:

The way I do it in OpenLayers is reproject my coordinate to epsg:900913 which is meters, do my calculations, and then convert back to the original projection. This can be accomplished with the pro4.j library: http://trac.osgeo.org/proj/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜