将Google地图链接转换为坐标 [英] Convert Google maps link to coordinates

查看:117
本文介绍了将Google地图链接转换为坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Google地图链接转换为GPS坐标? (我认为

How do I convert a Google maps link to GPS coordinates? (I think

10°11'12.0 N 13°14'15.0 E

10°11'12.0"N 13°14'15.0"E

是一个示例

我问的原因是Android的Google Maps(我使用Samsung Galaxy Note 3)似乎没有给出坐标。它只会提供Google链接。 (任何右键单击的说明都不能在手机中使用,只能在计算机中使用。)

The reason I ask is that Google Maps for Android (I use Samsung Galaxy Note 3) does not seem to give coordinates. It will only give Google links. (Any instructions with right click can not be followed in a phone, only in a computer.)

例如。如何转换以下链接以查找埃菲尔铁塔的坐标:

For example. How do I convert the following link to find the coordinates of the Eiffel Tower:

http://goo.gl/maps/VqEsU

我认为Google已有较早的标准,其中超链接参数包含坐标。但是,当前的标准更加含糊。

I think there have been earlier standards by Google where the hyperlink arguments contained the coordinates. But the current standard is more cryptic.

现在,我想在自己的Android(三星Galaxy Note 3)手机中手动进行操作。

Right now I want to do it manually in my Android (Samsung Galaxy Note 3) phone. But maybe the question is of interest for programmatic conversion too.

编辑:

这个问题是不是关于坐标的十进制和DMS(度,分,秒)格式之间的转换。可以使用许多网页和代码片段。

This question is NOT about the conversion between decimal and DMS (degrees, minutes, seconds) formats for coordinates. Many web pages and code-snippets are available for that.

推荐答案

您需要取消url链接,结果将是和嵌入了坐标的网址。在您的示例中:

You need to unshorten the url link, and the result will be and url with coordinates embedded in it. In your example:

>://://www.google.com/maps/place/Eiffel+Tower/@48.8583701,2.2922926,17z/ data =!3m1!4b1!4m2!3m1!1s0x0:0x8ddca9ee380ef7e0?hl = zh_CN

请参阅本主题,了解如何使用Python取消缩短:
如何取消缩短URL?

See this topic on how to unshorten using Python: How can I unshorten a URL?

然后,您需要解析它的坐标,例如通过搜索 @ 字符。假设您的长网址称为 longurl 。在Python中,您可以

Then you need to parse it for the coordinates, for example by searching for the @ character. Assume your long url is called longurl. In Python, you can do

import re
temp = re.search('@([0-9]?[0-9]\.[0-9]*),([0-9]?[0-9]\.[0-9]*)', longurl, re.DOTALL)
latitude  = temp.groups()[0]
longitude = temp.groups()[1]

(然后,您可以根据需要将其从DD进一步转换为分钟,秒。)

(Then you can further convert it from DD to minutes, seconds, if you need that.)

这篇关于将Google地图链接转换为坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆