Using Google maps API V3, specifically using the drawing tools (only the rectangle is enabled) as seen here:
https://developers.google.com/maps/documentation/javascript/overlays#drawing_tools
But I have the following question,
- Can I (if so how), by action of the user clicking a link on the same page, retrieve the lat,lng of the top left corner of the polygon and the bottom right, and send to a url, ie;
Retrieving the Rectangle
One way to retrieve the rectangle drawn by the user is to use Drawing Events:
Whenever a rectangle is drawn by the user, it will assign the Rectangle overlay object to the
rectangleglobal variable.Extracting information about the Rectangle
The
google.maps.Rectangleclass has agetBounds()method, which returns aLatLngBoundsobject. You can use thegetNorthEast()andgetSouthWest()methods to deduce the top-left and bottom-right corner coordinates.You can bind an
onclickevent to the link. The click event handler might look something like this:Further reading: