airnet
airnet

Reputation: 2673

google maps - extending polygon boundaries by a certain distance

I have a rectangular polygon and I want to extend the boundaries by 10 km for example.

How would I do that ? I could use extend method, but how Do I find the distance of 10 km in lat lng ?

So far I have : bounds = new google.maps.LatLngBounds(); pt = new google.maps.LatLng(lat,lng); bounds.extend(pt)

Upvotes: 1

Views: 415

Answers (2)

Cybercartel
Cybercartel

Reputation: 12592

It depends where you are looking at but a longitude is 111km and a latitude 110km:http://en.m.wikipedia.org/wiki/Latitude.

Upvotes: 0

aniri
aniri

Reputation: 1831

It depends on how exact an answer you need.

You could use the following approximation:

Latitude: 1 deg = 110.57 km; Longitude: 1 deg = 111.320 km source: http://en.wikipedia.org/wiki/Latitude

For a more exact formula, you need to check http://www.movable-type.co.uk/scripts/latlong.html . It has various formulas and also some code. You are looking for the section called 'Destination point given distance and bearing from start point'

Upvotes: 1

Related Questions