Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Ok so i have these cords:

55.623151, 8.48215

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

How can i do this?

like image 998
Karem Avatar asked Oct 22 '11 10:10

Karem


People also ask

Is Google reverse geocoding API free?

The Geocoding API uses a pay-as-you-go pricing model. Geocoding API requests generate calls to one of two SKUs depending on the type of request: basic or advanced. Along with the overall Google Terms of Use, there are usage limits specific to the Geocoding API.

Can Google Maps API calculate distance between two points?

What can you do with the Distance Matrix API? The API returns information based on the recommended route between start and end points. You can request distance data for different travel modes, request distance data in different units such kilometers or miles, and estimate travel time in traffic.


1 Answers

If you use Google Maps API v3, then you would proceed as follows:

Include the Geometry library into your Web page for Spherical Computations:

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

Then you can compute:

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 a running version on jsfiddle.

like image 198
Jiri Kriz Avatar answered Oct 06 '22 02:10

Jiri Kriz