How to take 5 km of points in all directions of location, geocoding google api?

So, I have these cords:

55.623151, 8.48215 

I would like to see geocodes 5 km from the north, south, east, west from this geography location above ^.

How can i do this?

+8
google-maps google-geocoder geocode
source share
1 answer

If you use the Google Maps API v3, you will proceed as follows:

Include the geometry library on your Spherical Computing webpage:

 <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false"> </script> 

Then you can calculate:

 var point = new google.maps.LatLng(55.623151, 8.48215); var spherical = google.maps.geometry.spherical; var north = spherical.computeOffset(point, 5000, 0); var west = spherical.computeOffset(point, 5000, -90); var south = spherical.computeOffset(point, 5000, 180); var east = spherical.computeOffset(point, 5000, 90); 

You can check the current version on jsfiddle .

+16
source share

All Articles