use*_*869 16 android google-maps google-api panoramio google-places-api
我正在使用Google Places API
检索有关地点的数据,但无法找到如何获取该地点的图片,Google Places API
只提供不一样的图标.例如,我需要您在网络浏览器中搜索Google地图中的地点时获得的照片.通常会有更多来自Panoramio的图片,但Panoramio API只能按位置搜索图片,而不能按特定的餐馆或酒店名称搜索.有任何想法吗?
Avr*_*yon 11
Places API将为您提供场所详细信息响应中的坐标(纬度和经度); 然后,您可以将坐标发送到Panoramio API.
例如(从API文档中的示例中提取):
https://maps.googleapis.com/maps/api/place/details/json?reference=<big long key for place>&sensor=true&key=AIzaSyAiFpFd85eMtfbvmVNEYuNds5TEF9FjIPI
响应:
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "48",
"short_name" : "48",
"types" : [ "street_number" ]
},
{
"long_name" : "Pirrama Road",
"short_name" : "Pirrama Road",
"types" : [ "route" ]
},
{
"long_name" : "Pyrmont",
"short_name" : "Pyrmont",
"types" : [ "locality", "political" ]
},
{
"long_name" : "NSW",
"short_name" : "NSW",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "AU",
"short_name" : "AU",
"types" : [ "country", "political" ]
},
{
"long_name" : "2009",
"short_name" : "2009",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "5/48 Pirrama Road, Pyrmont NSW, Australia",
"formatted_phone_number" : "(02) 9374 4000",
"geometry" : {
"location" : {
"lat" : -33.8669710,
"lng" : 151.1958750
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "4f89212bf76dde31f092cfc14d7506555d85b5c7",
"international_phone_number" : "+61 2 9374 4000",
"name" : "Google Sydney",
"rating" : 4.60,
"reference" : "CnRlAAAAAfV6JIqSzL8Cf4VnXn0EaI1d5k3IPhdkEonq0MxiUbQFFSVuptVbXbNH4mrevb0bc7G8yWqTUv76i4KTuO_Wf3OrRHjCJJwzQ0mNLjbYGSVqy2eqyrgOUkl6S_sJfTbHzWZYrfPy7KZaet0mM5S6thIQJYuy5v_JD--ZxXEJLWTQRRoU5UaciXBBo89K-bce18Ii9RsEIws",
"types" : [ "store", "establishment" ],
"url" : "http://maps.google.com/maps/place?cid=10281119596374313554",
"vicinity" : "5/48 Pirrama Road, Pyrmont",
"website" : "http://www.google.com.au/"
},
"status" : "OK"
}
Run Code Online (Sandbox Code Playgroud)
我们可以看到坐标是"位置":{"lat": - 33.8669710,"lng":151.1958750}
然后我们可以向Panoramio发送请求,插入坐标,并在两侧加上一个小摆动室(我做了+/- 0.002度,在赤道上形状200米×200平方米,通常更小).
http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=20&minx=-33.868&miny=151.193&maxx=-33.864&maxy=151.197&size=medium&mapfilter=true
您可能需要对响应进行一些过滤以获得最接近的照片,但这应该可以为您提供一些帮助.
Dyl*_*lan 10
Places API刚刚添加了直接在API中请求照片的功能:https://developers.google.com/maps/documentation/javascript/places#places_photos
Places API现在支持返回一张地方照片(如果可用于地方搜索请求)和最多十张地方照片的地方详细信息请求.
如果照片阵列与您的要求退换,你可以通过photo_reference
从一个包含照片对象到地方照片请求,与maxheight
和/或maxwidth
,sensor
和key
参数:
https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRvAAAAwMpdHeWlXl-lH0vp7lez4znKPIWSWvgvZFISdKx45AwJVP1Qp37YOrH7sqHMJ8C-vBDC546decipPHchJhHZL94RcTUfPa1jWzo-rSHaTlbNtjh-N68RkcToUCuY9v2HNpo5mziqkir37WU8FJEqVBIQ4k938TI3e7bf8xq-uwDZcxoUbO_ZJzPxremiQurAYzCTwRhE_V0&sensor=false&key=AddYourOwnKeyHere
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请参阅文档.
归档时间: |
|
查看次数: |
52071 次 |
最近记录: |