我在閱讀:http://www.panoramio.com/api/widget/api.html#photo-widget構建一個JavaScript照片小部件。獲取給定的一個經度和一個經度的四個點的矩形只有
在Request
- >request object
表,它寫的是:
名稱:rect
例如值:{'sw': {'lat': -30, 'lng': 10.5}, 'ne': {'lat': 50.5, 'lng': 30}}
含義:This option is only valid for requests where you do not use the ids option. It indicates that only photos that are in a certain area are to be shown. The area is given as a latitude-longitude rectangle, with sw at the south-west corner and ne at the north-east corner. Each corner has a lat field for the latitude, in degrees, and a lng field for the longitude, in degrees. Northern latitudes and eastern longitudes are positive, and southern latitudes and western longitudes are negative. Note that the south-west corner may be more "eastern" than the north-east corner if the selected rectangle crosses the 180° meridian
但通常我們只給出一個緯度點和一個經度點。
我應該寫什麼樣的表情來構建上述四點,以覆蓋我手邊有兩點的區域周圍的圖片?
例如,我在巴黎:
緯度:48.8566667
LNG:2.3509871
我想捂住它周圍的圖片10公里矩形。
謝謝。
可能DUP http://stackoverflow.com/questions/238260/how-to-calculate-the-bounding-box-for-a-given-lat-lng-location – kjy112 2011-04-16 14:15:04
謝謝。它是。 – Victor 2011-04-16 14:26:32