通过 API 将帖子(图像)发布到谷歌地图营业位置

发布于 2025-01-14 20:50:20 字数 1437 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无所的.畏惧 2025-01-21 20:50:20

您可以使用地点照片 API。地点照片服务是 Places API 的一部分,是一个只读 API,允许您向应用程序添加高质量的照片内容。这使您可以访问存储在地点数据库中的数百万张照片。

要使用它,您只需发送以下形式的 HTTP URL 的“放置照片”请求:

https://maps.googleapis.com/maps/api/place/photo?parameters

示例如下:

https://maps.googleapis.com/maps/api/place/photo
  ?maxwidth=400
  &photo_reference=Aap_uEA7vb0DDYVJWEaX3O-AtYp77AaswQKSGtDaimt3gt7QCNpdjp1BkdM6acJ96xTec3tsV_ZJNL_JP-lqsVxydG3nh739RE_hepOOL05tfJh2_ranjMadb3VoBYFvF0ma6S24qZ6QJUuV6sSRrhCskSBP5C1myCzsebztMfGvm7ij3gZT
  &key=YOUR_API_KEY

如您所见,有一个 photo_reference 参数。这可以在对查找地点 API 的响应中找到, 附近搜索 API, <一个href="https://developers.google.com/maps/documentation/places/web-service/search-text" rel="nofollow noreferrer">文本搜索 API,或 地点详情 API 网络请求。

以下是地点详细信息 API Web 请求的示例,用于获取地址 48 Pirrama Rd, Pyrmont NSW 2009, Australia 的照片参考:

https://maps.googleapis.com/maps/api/place/details/json
  ?fields=photo
  &place_id=ChIJN1t_tDeuEmsRUsoyG83frY4
  &key=YOUR_API_KEY

我在 中使用 photo >fields 参数来获取地址的照片参考:链接

正如您从地点详细信息 API 响应中看到的,该地址有多个照片引用。

要获取照片,我们只需使用 Place Details API 响应中的照片引用,并将其放入 Place Photo API 请求的 photo_reference 参数中。这是一个例子:

https://maps.googleapis.com/maps/api/place/photo
  ?maxwidth=400
&photo_reference=Aap_uEBzMi8oa8zOmZQoAFNNGq1E6wS4GuzFJu-zrNlnB254m8yrHhp9SpE-6U90PaqyLESwpX3avM1wVRKp9enfT_Yo6fl_2GR50nWd_CEJLuBOMZtomgXVdQfL8-7K4rO3hiagtQI44cr4KvQuv-sN9N3FOnIvMqD4W5IZtPgCh1oEZyQI
  &key=YOUR_API_KEY

You can use Place Photos API. The Place Photo service, part of the Places API, is a read- only API that allows you to add high quality photographic content to your application. This gives you access to the millions of photos stored in the Places database.

To use, you just have to send Place Photo request is an HTTP URL of the following form:

https://maps.googleapis.com/maps/api/place/photo?parameters

An example of it is:

https://maps.googleapis.com/maps/api/place/photo
  ?maxwidth=400
  &photo_reference=Aap_uEA7vb0DDYVJWEaX3O-AtYp77AaswQKSGtDaimt3gt7QCNpdjp1BkdM6acJ96xTec3tsV_ZJNL_JP-lqsVxydG3nh739RE_hepOOL05tfJh2_ranjMadb3VoBYFvF0ma6S24qZ6QJUuV6sSRrhCskSBP5C1myCzsebztMfGvm7ij3gZT
  &key=YOUR_API_KEY

As you can see, there is a photo_reference parameter. This can be found in the response to a Find Place API, Nearby Search API, Text Search API, or Place Details API web request.

Here is an example of Place Details API web request to get the photo reference of the address 48 Pirrama Rd, Pyrmont NSW 2009, Australia:

https://maps.googleapis.com/maps/api/place/details/json
  ?fields=photo
  &place_id=ChIJN1t_tDeuEmsRUsoyG83frY4
  &key=YOUR_API_KEY

I use the photo in the fields parameter to get the address' photo reference: link

As you can see from the Place Details API response, there are multiple photo references for this address.

To get the photo, we'll just use a photo reference from the Place Details API response, and put it in the photo_reference parameter of the Place Photo API request. Here's an example:

https://maps.googleapis.com/maps/api/place/photo
  ?maxwidth=400
&photo_reference=Aap_uEBzMi8oa8zOmZQoAFNNGq1E6wS4GuzFJu-zrNlnB254m8yrHhp9SpE-6U90PaqyLESwpX3avM1wVRKp9enfT_Yo6fl_2GR50nWd_CEJLuBOMZtomgXVdQfL8-7K4rO3hiagtQI44cr4KvQuv-sN9N3FOnIvMqD4W5IZtPgCh1oEZyQI
  &key=YOUR_API_KEY
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文