Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Calculate Distance using google.maps.geometry.spherical.computeDistanceBetween
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry" type="text/javascript"></script>
<script type="text/javascript">
function calcDistance (fromLat, fromLng, toLat, toLng) {
return google.maps.geometry.spherical.computeDistanceBetween(
new google.maps.LatLng(fromLat, fromLng), new google.maps.LatLng(toLat, toLng));
}
</script>
@bernajs

This comment has been minimized.

Copy link

commented May 11, 2017

Nice, thanks a lot <3

@cagb80

This comment has been minimized.

Copy link

commented Jun 17, 2018

Thank You... this worked for me!

@denyjackrose

This comment has been minimized.

Copy link

commented Jun 26, 2018

Thanks man... You save my day T_T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.