How do i get the coordinates of all four corners of a Rectangle?

丶灬走出姿态 提交于 2020-01-04 06:39:48

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/3891066/how-do-i-get-the-coordinates-of-all-four-corners-of-a-rectangle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!