我正在阅读这个: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
液化天然气:2.3509871
我想要覆盖它周围的图片10公里的矩形。
谢谢。
发布于 2011-08-20 00:12:57
这是我从Panoramio Forum by QuentinUK得到的答案。
不能做10公里的距离,因为这意味着一个圆形区域。它只能做矩形。
所以你可以近似(最好是使用Vincenty的公式),并计算该点周围的角度+/-。
function requestAroundLatLong(lat,lng,km){
// angle per km = 360 / (2 * pi * 6378) = 0.0089833458
var angle=km* 0.0089833458;
var myRequest = new panoramio.PhotoRequest({
'rect': {'sw': {'lat': lat-angle, 'lng': lng-angle}, 'ne': {'lat': lat+angle, 'lng': lng+angle}}
});
return myRequest;
}
var widget = new panoramio.PhotoWidget('wapiblock', requestAroundLatLong(48.8566667, 2.3509871,10), myOptions); 发布于 2013-03-06 07:23:11
如果您想使用REST api:
var纬度= "48.8566667";var经度= "2.3509871";
变角= km * 0.0089833458;
testo.Text = "<script src=\"http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=full&from=0&to=14&minx=" + clon - angle + "&miny=" + clat - angle + "&maxx=" + clon + angle + "&maxy=" + clat + angle + "&callback=mostrareFotos&size=medium\" type=\"text/javascript\"></script>";https://stackoverflow.com/questions/5686887
复制相似问题