【问题标题】:Geo-coding for intersection street using Python使用 Python 对交叉路口进行地理编码
【发布时间】:2018-10-04 04:18:18
【问题描述】:

有谁知道如何获取 2 条道路交点的 latitudelongitude 给定 2 条道路地址和 Map API(如 Google map API)?

我目前在geopy 等处找到了适用于 Python 的解决方案。

谢谢!

【问题讨论】:

标签: python api dictionary geocoding geopy


【解决方案1】:
def loc(streetA, streetB):
    res = requests.get('https://www.google.com/maps/place/'+streetA+' & '+streetB)
    return re.findall(r'll=(.*?)" item', res.text)[0].split(',')

gps = loc('19th rd nw', 'kafir rd')
print(gps)
>>['38.302811', '-95.767682']

它不是一个 api,但你总是可以抓取谷歌地图?这是我拼凑的一个函数,它接受两个代表相交道路的字符串。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-14
    • 1970-01-01
    • 1970-01-01
    • 2022-10-24
    • 2012-11-06
    • 1970-01-01
    • 2015-09-24
    • 1970-01-01
    相关资源
    最近更新 更多