One important thing is you have to make sure to include the geometry 
library when you declare your javascript for gmaps

src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry";

I just did this, my goal was to draw a 1km box around a point. 

ne = google.maps.geometry.spherical.computeOffset(latlng, 500, 0)

latlng is the original latlng object, 500 is the number of meters you want 
to go, 0 is the number of degrees from North that you want to move in. (0 
goes straight up, 90 goes east, 180 south, 270 west)
ne is the resulting latlng 
So to build a square around a point I did:
ne = google.maps.geometry.spherical.computeOffset(latlng, 500, 0) 
ne = google.maps.geometry.spherical.computeOffset(ne, 500, 90)
se = google.maps.geometry.spherical.computeOffset(ne, 1000, 180)
sw = google.maps.geometry.spherical.computeOffset(se, 1000, 270)
nw = google.maps.geometry.spherical.computeOffset(sw, 1000, 0)

var box = new google.maps.Rectangle({
        map:map,
        strokeOpacity:5,
        bounds:new google.maps.LatLngBounds(sw,ne)
        });


On Monday, March 5, 2012 8:33:11 AM UTC-5, geoco...@gmail.com wrote:
>
> On Mar 5, 5:10 am, khaldoon <khaldoon.ma...@gmail.com> wrote: 
> > Hi, 
> > Is there any way to add 5km distance to latitude, in order to move 
> > geographic point to 5 km north or add 5 km to longitude to move 5km 
> east. I 
> > want to get the new lat and  lng after adding distance value. 
> > Example: 
> > lat1: 34 
> > lng1: 34 
> > after adding 5km in lat1, new point should be like 
> > new_lat1: 34+5km 
> > new_lng1: 34 (lng1 will remain same as we only added in latitude) 
>
> http://www.movable-type.co.uk/scripts/latlong.html 
>
> some of that functionality is in the "Geometry" library: 
> http://code.google.com/apis/maps/documentation/javascript/geometry.html 
>
>   -- Larry

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/6vCuAACwq7UJ.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to