如何从谷歌地图 URL 获取某个位置的地址?

2024-01-06

给定谷歌地图位置的 URL,我希望能够获取该位置的地址。

例如给定这个 URL:

https://www.google.com/maps/place/Eiffel+Tower/@48.8583701,2.2922926,17z/data=!3m1!4b1!4m5!3m4!1s0x47e66e2964e34e2d:0x8ddca9ee380ef7e0!8m2!3d48.8583701!4d2。 2944813 https://www.google.com/maps/place/Eiffel+Tower/@48.8583701,2.2922926,17z/data=!3m1!4b1!4m5!3m4!1s0x47e66e2964e34e2d:0x8ddca9ee380ef7e0!8m2!3d48.8583701!4d2.2944813

我想获取它的地址:

Champ de Mars, 5 Avenue Anatole France, 75007 巴黎, 法国

我有什么想法可以做到这一点吗?我研究过 google 地图 API,但没有找到实现此目的的方法。


如果您查看示例 URL

https://www.google.com/maps/place/Torre+Eiffel/@48.8583701,2.2922926,17z/data=!3m1!4b1!4m5!3m4!1s0x47e66e2964e34e2d:0x8ddca9ee380ef7e0!8m2!3d48.8583701!4d2.2944813

仔细观察,您会注意到“!1s”之后和“!8m2”之前的以下代码:

0x47e66e2964e34e2d:0x8ddca9ee380ef7e0.

此代码是该地点的功能 ID。例如,您可以使用 regexp 从 URL 中提取此代码。之后,您可以用“:”分割代码并使用第二部分(0x8ddca9ee380ef7e0)来代替带有参数的详细信息请求cid。请注意,此参数没有公开记录,但在编写此未记录的参数时,它可以按预期工作。

执行以下请求

https://maps.googleapis.com/maps/api/place/details/json?cid=0x8ddca9ee380ef7e0&key=YOUR_API_KEY

您将得到以下回复

{
html_attributions: [ ],
result: {
address_components: [
{
long_name: "Champ de Mars",
short_name: "Champ de Mars",
types: [
"point_of_interest",
"establishment"
]
},
{
long_name: "5",
short_name: "5",
types: [
"street_number"
]
},
{
long_name: "Avenue Anatole France",
short_name: "Avenue Anatole France",
types: [
"route"
]
},
{
long_name: "Paris",
short_name: "Paris",
types: [
"locality",
"political"
]
},
{
long_name: "Arrondissement de Paris",
short_name: "Arrondissement de Paris",
types: [
"administrative_area_level_2",
"political"
]
},
{
long_name: "Île-de-France",
short_name: "Île-de-France",
types: [
"administrative_area_level_1",
"political"
]
},
{
long_name: "France",
short_name: "FR",
types: [
"country",
"political"
]
},
{
long_name: "75007",
short_name: "75007",
types: [
"postal_code"
]
}
],
adr_address: "Champ de Mars, <span class="street-address">5 Avenue Anatole France</span>, <span class="postal-code">75007</span> <span class="locality">Paris</span>, <span class="country-name">France</span>",
formatted_address: "Champ de Mars, 5 Avenue Anatole France, 75007 Paris, France",
formatted_phone_number: "0 892 70 12 39",
geometry: {
location: {
lat: 48.85837009999999,
lng: 2.2944813
},
viewport: {
northeast: {
lat: 48.8597461302915,
lng: 2.29610765
},
southwest: {
lat: 48.85704816970851,
lng: 2.29251745
}
}
},
icon: "https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
id: "fd0cfb424bbd79bf28a832e1764f1c2aa5927714",
international_phone_number: "+33 892 70 12 39",
name: "Eiffel Tower",
opening_hours: {
open_now: true,
periods: [
{
close: {
day: 1,
time: "0045"
},
open: {
day: 0,
time: "0900"
}
},
{
close: {
day: 2,
time: "0045"
},
open: {
day: 1,
time: "0900"
}
},
{
close: {
day: 3,
time: "0045"
},
open: {
day: 2,
time: "0900"
}
},
{
close: {
day: 4,
time: "0045"
},
open: {
day: 3,
time: "0900"
}
},
{
close: {
day: 5,
time: "0045"
},
open: {
day: 4,
time: "0900"
}
},
{
close: {
day: 6,
time: "0045"
},
open: {
day: 5,
time: "0900"
}
},
{
close: {
day: 0,
time: "0045"
},
open: {
day: 6,
time: "0900"
}
}
],
weekday_text: [
"Monday: 9:00 AM – 12:45 AM",
"Tuesday: 9:00 AM – 12:45 AM",
"Wednesday: 9:00 AM – 12:45 AM",
"Thursday: 9:00 AM – 12:45 AM",
"Friday: 9:00 AM – 12:45 AM",
"Saturday: 9:00 AM – 12:45 AM",
"Sunday: 9:00 AM – 12:45 AM"
]
},
photos: [
{
height: 408,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/105303505373661530610/photos">Hauser Quaid Zzyzx</a>"
],
photo_reference: "CmRaAAAAFOGpKiedFvYYu7R7qLkxqdY2GqcGqmHNPvny_a2dYV81XTFC2RL0ybS-NZg_oQUa0Fa-U178CBPLmCx8Xz_PTt16jW87WUm9rdYHoVklaAeH52pVuCwW1014vu-5EboPEhDHt-Gt9o_2tEKXWt6FQVXwGhSnNEX49VjoMdiPlXPaZ3z18yN-_A",
width: 612
},
{
height: 3888,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/101948575993173983825/photos">Gonçalo Borralho</a>"
],
photo_reference: "CmRaAAAAJLOe9SSk1G-d8KTm5dFPw-CAvXd7SK5eg0AS2_zF7eTsNGDJZptupKLRodFE9GfdpRcxYhTzIWkoBx2EIEPamq_A5G8A7Q905KlIkDln6Kz83xIDDjY5D4FBHCQnySriEhBRME9npMoGWKdfz2HDJnV3GhRQT2YZDE2axrCDGbWguRiYaDP4jw",
width: 2592
},
{
height: 600,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/110560344886268390808/photos">Maria Goryunova</a>"
],
photo_reference: "CmRaAAAAbZO6_2CHj1TxxpNu9-un01rYHMy7v7MhiWB4auCwwqp8a2xkSlWiheQZQBG6kGHp0qPkn6NNwhup9teVKZUjmPTqvMFhI5ER0WyX-RrhHFStBMa5it6qT6V7H4VI297KEhCr-hcQDRTtE0q3fEqWKlnXGhRme7pNMXQRYxuXIpJAkWtEVxQ_Mw",
width: 600
},
{
height: 4160,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/117413321655290324764/photos">praveen dhingra</a>"
],
photo_reference: "CmRaAAAA_WjfpbIVJ5zVIy1j-0Q2VKwxGjbGQNzcD9F6rIFEAVqQEvrv_OSrfTX3Mac8NwDopr1rl63jZGUbExJkQDckM-DGr9TQqfT7FTLbSxtOra6NTIa5jijTkTh-Ivw_uB1dEhCeiq5yjZZjBfRnmc2SLUxYGhQ4XOKL7PlMZpgZ_Be_b3oK8hHwIw",
width: 2080
},
{
height: 4000,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/109586342110736030196/photos">H.İbrahim Üzmezoğlu</a>"
],
photo_reference: "CmRaAAAAmLIY1pgIGZL720khB_lfo956P3UX_rnBZG0KxTImqJCR8sZGHXGv7IdcIM_c5kaIYLkeG-WwXehU367cLhN8ordS0lqCITaiXL2w2HdL0mABPcr3JYw4fGBsv_I4ScK-EhCJDIwwlPEel5mXVt0Ype10GhTbA4MsOMt9mVegngR7AOIjqYiX3w",
width: 3000
},
{
height: 3648,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/104243695644908686665/photos">Kerem Enginar</a>"
],
photo_reference: "CmRaAAAACLc5gwLJxZRPVQI-5X_iI1TyaFwc6HA1aFYeSzDAU7514FU_iEYWxVEEgpavyXmC4PU1x-NVvCSOyxBVEbcX2wgYp6dMsIgg2wK11HvlZW2OxHAVsiDv2m3Qk7hXyhApEhCiR3DSFJ8dwHtsH4OMKCuqGhRcFAIpkIp0XvhAXpHmkFRnfVcGCQ",
width: 1744
},
{
height: 3968,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/110131594451511930557/photos">LUIS ROLDAN</a>"
],
photo_reference: "CmRaAAAAwyx_YEdelPVTlgqw9KWqXuXKuzDRS9m6gyemO9HIIJGNSVfW-kYClF8TeKqxZt9YvSe9SnhmCMzFGr5fKeKUbiTIz0wAFNvZysdqT9TV8nJ009m-FTtB0Rx8RC0h70e5EhCIUcnE8JgPBue7IUmwOA0fGhRzbGCB5-35S34i7AIaJXu9CEE2jg",
width: 2976
},
{
height: 4032,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/117736543070762131171/photos">Frank Rafaelsen Lian</a>"
],
photo_reference: "CmRaAAAAFTSEd1eR_zkspc7ksK3S22nq69UXYtW8DGR7B7yfCiL2Q_IJl29yofflEj5HQ8ANuLyQR-NlSYGN3FhnC5jj-zGqUR4wTv-_B-imPEnCvq2mHDz_gO43bbc2xQmcGsecEhCR7Uryl1QTECndlU0f94uuGhT4CYw5JLAO-27Gi_cIdK9Ic1YFxA",
width: 3024
},
{
height: 3024,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/101863804180255933702/photos">Wadih Antoun</a>"
],
photo_reference: "CmRaAAAA6A_JRLItYa05p9NcXapox8ROY_h2id9AVewX1wChZPP8iBZvA1JHQo9qEFGwyTUuXQ9Pu7-xXgKJkgCepp2SkSdprRjBfvcmt-ZQUH4LjigupU1AAqzMZRVXKbZ2WjHgEhBAIQ2EgygtvhtZSy6Y7QJbGhTLTj0jgWPIJVTxHgUFzqWbnnnymw",
width: 4032
},
{
height: 4224,
html_attributions: [
"<a href="https://maps.google.com/maps/contrib/106542752122609581725/photos">Steve Bird</a>"
],
photo_reference: "CmRaAAAAGbShlT71nLeJHL5sagdgtjssvWCBhDsqPsZ9xeNXu48iFlBsRoRarZZTMUJSK0p2H91Rg27XE8HFCRvvgxLTctA9eJhCktsDoOjP33zw04sX19jrrMhGpS0kOemTV-daEhAz41RPzVtazLhOYKdmkSHqGhRPd9g9S94_N0HrxV9oRcPCHfd2ZQ",
width: 2368
}
],
place_id: "ChIJLU7jZClu5kcR4PcOOO6p3I0",
plus_code: {
compound_code: "V75V+8Q Paris, France",
global_code: "8FW4V75V+8Q"
},
rating: 4.6,
reference: "ChIJLU7jZClu5kcR4PcOOO6p3I0",
reviews: [
{
author_name: "Margaret Bagdon",
author_url: "https://www.google.com/maps/contrib/115820855361415255644/reviews",
language: "en",
profile_photo_url: "https://lh5.googleusercontent.com/-L8M8JctpleE/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reM2h_11AXwURDawihkuOG34a9MQg/s128-c0x00000000-cc-rp-mo-ba4/photo.jpg",
rating: 4,
relative_time_description: "in the last week",
text: "I purchased tickets on line for 9:00 on a Tues in June. Couldn't print my tickets because of a problem with the account so we showed up early to have them printed. We we're lucky no one was in line at the info booth. We waited in the line (30 minutes) for the time slot we booked. The line to purchase tickets was much longer so I recommend you buy in advance. We rode the glass side lift to the first observation deck and immediately got in line to go to the summit. Waited about 15 minutes. The top was crowded and we watched the sunset from the top. The views are nice so I think it was worth it. You can purchase a small glass of champagne if you want a toast at the top. We took the lift down and stopped for a drink and a rest. We walked the remainder of the way and got down in time to see the brief light show. Good view on the lawn. I would recommend stopping here if it is your first time in Paris and you don't mind heights.....be prepared to wait....and it will be crowded.....and expensive...",
time: 1563234656
},
{
author_name: "Shahrukh Naeem",
author_url: "https://www.google.com/maps/contrib/102499154519714023927/reviews",
language: "en",
profile_photo_url: "https://lh4.googleusercontent.com/-qQBtFB0REZI/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rd9bYBR5bZcH6BMYaRd5yv2Gw79WQ/s128-c0x00000000-cc-rp-mo-ba5/photo.jpg",
rating: 5,
relative_time_description: "2 weeks ago",
text: "Wonderful romantic place. Must visit with loved ones. Breathtaking view from up the level 2. People can also buy an additional Ticket and go up to the next level to even have a wonderful view or dine with love. Sure a wonder to visit and of course go on top of it. So many romantic couples were taking romantic photos in this structure. In the night there was a five minute light show which has to be viewed from a distance to enjoy how magnificently people made this city a tourist attraction because of this structure",
time: 1562399468
},
{
author_name: "Anca Chelaru",
author_url: "https://www.google.com/maps/contrib/113471456079540231282/reviews",
language: "en",
profile_photo_url: "https://lh4.googleusercontent.com/-UnNJLd9XjiM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcGIic0U1eWvnrKz-xfp2s6mqI2vg/s128-c0x00000000-cc-rp-mo-ba3/photo.jpg",
rating: 5,
relative_time_description: "a week ago",
text: "I loved it! It is better than Empire State Building because you see the empty space going up/down and it gives you an adrenaline rush, that you don't feel in a building. You can take the stairs on the way down, better than the elevator. At the restaurant level, there is glass floor, so you can see all the way down. The gift store at the restaurant level is better than the on on top, it has more staff. Buy the tickets online, saves time. You can easily spend here 1/2 a day.",
time: 1562661564
},
{
author_name: "Jeroen van der Linde",
author_url: "https://www.google.com/maps/contrib/109990025751819839602/reviews",
language: "en",
profile_photo_url: "https://lh5.googleusercontent.com/-g03RbnKDnJ8/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3ren8G7DFs0oZV0hkiYaBdYRydQleQ/s128-c0x00000000-cc-rp-mo-ba6/photo.jpg",
rating: 5,
relative_time_description: "a week ago",
text: "Of course one of the main tourist attractions in Paris, France and even the world. Elevators work now but you can still take the stairs if you want to have a cheaper option to go up. T The direct area is fenced off with high bullet proof glass walls and protected entrances at the sides. Visitors are subject to some screening. If you are looking for pictures of the Eiffel Tower you can also visit the lawn or pond at the sides for better views.",
time: 1562921719
},
{
author_name: "Pratap Ramamoorthy",
author_url: "https://www.google.com/maps/contrib/117384906578505429183/reviews",
language: "en",
profile_photo_url: "https://lh3.googleusercontent.com/-Oo8pn66vGDM/AAAAAAAAAAI/AAAAAAAAA7g/rXZn8xS2bPg/s128-c0x00000000-cc-rp-mo-ba6/photo.jpg",
rating: 5,
relative_time_description: "a month ago",
text: "Wonderful romantic place. Must visit with loved ones. Breathtaking view from up the level 2. People can also buy an additional Ticket and go up to the next level to even have a wonderful view or dine with love. Sure a wonder to visit and of course go on top of it. So many romantic couples were taking romantic photos in this structure. In the night there was a five minute light show which has to be viewed from a distance to enjoy how magnificently people made this city a tourist attraction because of this structure.",
time: 1559894189
}
],
scope: "GOOGLE",
types: [
"premise",
"point_of_interest",
"establishment"
],
url: "https://maps.google.com/?cid=10222232094831998944",
user_ratings_total: 166537,
utc_offset: 120,
vicinity: "Champ de Mars, 5 Avenue Anatole France, Paris",
website: "http://www.toureiffel.paris/"
},
status: "OK"
}

formatted_address 字段包含您要查找的地址“Champ de Mars, 5 Avenue Anatole France, 75007 Paris, France”。

我希望这有帮助!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何从谷歌地图 URL 获取某个位置的地址? 的相关文章

随机推荐

  • C 中对“main”的未定义引用

    您好 我在使用 gcc 编译 c 代码时遇到以下错误 usr lib gcc x86 64 redhat linux 4 4 6 lib64 crt1 o In function start text 0x20 undefined refe
  • MS SQL 异常:“@P0”附近的语法不正确

    我正在使用 MS SQL 查询数据库 由于某种原因 我收到以下错误 com microsoft sqlserver jdbc SQLServerException Incorrect syntax near P0 即使这个 P0 不在我的语
  • 将数据插入文本文件

    我想在文本文件中的某些位置插入数据 而不实际覆盖现有数据 我有两个文本文件 one txt 文件有 1000 行 two txt 文件有 10000 行 我想读取 one txt 文件内容并插入 two txt 文件内容的前1000行 将
  • 合并 2 个对象数组

    让我们看一个例子 var arr1 new Array name lang value English name age value 18 var arr2 new Array name childs value 5 name lang v
  • vue-template-compiler/package.json 每个新项目都缺少模块

    目前 我从linux切换到windows 开始创建编程环境 我不记得linux上有类似的问题 但重点是 1 安装的 Node js2 npm install g vue cli用于 CLI 安装3 vue create my app 4 n
  • JFileChooser - 多个文件过滤器?

    我对 Swing 中的 JFileChooser 有疑问 我试图在下拉框中获取多个文件扩展名 但不知道该怎么做 有方法 extFilter FileNameExtensionFilter description extensions 然后我
  • 可移植类库不支持System.IO,为什么?

    我创建了一个便携式类库用于我的Monodroid项目 但问题是我需要系统IO库 但不幸的是我无法添加它 我什至尝试通过 添加引用 选项来添加它 但这是徒劳的 为什么会发生这样的事 我该怎么做 你不能使用System IO因为它不是一个可移植
  • 在服务层或存储库层管理事务?

    我有一个特定的场景 其中基于某些约束在多个表上完成插入和更新 因此很自然地在这些场景中使用事务范围 现在 我有一个存储库层和一个服务层 服务层调解存储库和 UI 并且始终处于无知状态 现在我很困惑在服务层或存储库层中的何处使用事务 我没有使
  • Facebook Sdk 尚未初始化 FacebookSdk.sdkInitialize()

    嘿 我知道以前有人问过这个问题 但似乎没有一个解决方案有帮助 我在我的应用程序中第一次使用 Facebook SDK 我尝试过的 我已经尝试过大部分在Internet但没有得到任何关于此事的信息 这是我的 MainActivity java
  • Qt 为什么不使用异常处理?

    我一直想知道 由于 Qt 以一种美妙且创新的方式使用了标准中的几乎所有 C 功能 并且每当它不使用特定功能时 它都有一个完全有效且适用的理由不这样做 在这种情况下 为什么没有 Qt 类使用throw关键字和throw有什么例外吗 他们从不要
  • C++ 中的向量下标超出范围错误

    我正在尝试编写一个程序 它接受 n 个整数的输入 并找出给定输入中出现次数最多的那个 我正在尝试为 t 种情况运行该程序 为此 我实现了一种类似计数排序的算法 可能有点天真 它计算输入中每 个数字出现的次数 如果有多个数字具有相同的最大出现
  • AttributeError:“list”对象在 App Engine 中没有属性“has_key”

    我在应用程序引擎的批量加载器方面遇到一些问题 下面我插入了bulkloader yaml hs transformers py 和错误日志 知道是什么产生了这个错误吗 我的hs transformer如果我返回单个实体 只是一个实体 而不是
  • 在 jquery UI datepicker 范围中使用 altFormat 和 altField

    我正在尝试获取 从 和 到 的日期范围 以将其添加到我的数据库中 我使用 altFormat 和 altField 捕获 DB 格式 yy mm dd 的日期 同时使用 Datepicker jquery UI 组件在 UI 中显示正常日期
  • Three.js 图像不是两个警告的幂

    我对从 Three js 收到的警告有疑问 警告是 THREE WebGLRenderer 图像不是2的幂 600x480 调整大小为 512x512我尝试添加 THREE LinearFilter 但它没有任何作用 var texture
  • 与 MediaRecorder Android 6.0 (API 23) 一起使用的“Seekable”文件描述符

    所以我尝试使用我的 Android 作为网络摄像头 我的代码对于 API ParcelFileDescriptor s createPipe 创建用于读取和写入的管道的方法 简而言之 我对管道的写入如下所示 ParcelFileDescri
  • 从文档目录中的文件夹创建 ZIP 文件 - Objective C (ARC)

    我有一个使用 ARC 开发的 iPhone 应用程序 我的文档目录中有一个文件夹 其中包含一堆图像 我需要将其压缩并通过电子邮件发送 我的项目使用ARC 有人有任何对我有帮助的示例代码 资源链接吗 我在网上查了一下 发现与 ARC 不兼容
  • 捕获比屏幕大的整个滚动视图[重复]

    这个问题在这里已经有答案了 主要问题是将整个滚动视图保存为位图图像 而不仅仅是屏幕上显示的图像 有没有办法保存整个滚动视图 如果可以的话如何保存 在ScrollView中创建RelativeLayout或LinearLayout以从Layo
  • 使用 gstreamer 将 YUVj420p 像素格式转换为 RGB888

    我使用 gstreamer 1 2 将帧从我的 IP 摄像头馈送到 opencv 程序 流是 640 368 YUVj420p 我想将其转换为RBG888以便能够在我的opencv程序中使用它 那么有没有办法使用 gstreamer 来进行
  • Bash 4.2 中的 IFS 发生变化

    运行这些命令会给出预期的结果 bash version GNU bash version 4 1 11 2 release foo 111 222 333 IFS cat lt lt lt foo 111 222 333 然而 在 Bash
  • 如何从谷歌地图 URL 获取某个位置的地址?

    给定谷歌地图位置的 URL 我希望能够获取该位置的地址 例如给定这个 URL https www google com maps place Eiffel Tower 48 8583701 2 2922926 17z data 3m1 4b