JING 2013-04-26
代码如下:
var oldMarker = new google.maps.Marker({ position: new google.maps.LatLng("31.95678", "177.898673"), map: map, title:"old" }); var newMarker = new google.maps.Marker({ position: new google.maps.LatLng("31.45678", "177.098673"), map: map, title:"new" });
代码如下:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=geometry"></script>
代码如下:
var meters = google.maps.geometry.spherical.computeDistanceBetween(oldMarker.getPosition(), newMarker.getPosition()); document.getElementById("distance").innerText = meters+"米";