views:

41

answers:

1

How can i retrieve OR calculate the coordinates of the NW or SE corners of a Rectangle?

I'm using Google Maps API v3 and I know there is the getBounds() method which returns the NE and SW coordinates of the rectangle.

I need all four coordinates because KML 2.2 does not have a rectangle schema spec, it only has the polygon schema and i need to be able to export my rectangle into a kml as a polygon.

+2  A: 

NW coordinates - (x1, y1)
SE coordinates - (x2, y2)
NE coordinates - (x2, y1)
SW coordinates - (x1, y2)

Mathias Schnell
Mathias can you please elaborate? Are x1, y1 properties of bounds?
krefftc
You said that the Google Maps function getBounds() returns the NE and SW coordinates of your rectangle. x1 and y1 are the given coordinates of the NE corner, x2 and y2 are the given coordinates of the SW corner. Given that you can figure out that the coordinates of the NE corner are (x2,y1) and the coordinates of the SW corner are (x1,y2).
Mathias Schnell
simply genius!!
krefftc