在这里无法获得正确的python语法映射反向地理编码

2024-04-25 01:48:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在这里使用api来反转地理代码lat/lon。我尝试如下:

geohere = here('{}, {}'.format(centroid.GetY(), centroid.GetX()), app_id='WCvPg4vFEghHoPxTaRGM', app_code='yfuHH1jW8oIg7ILD1CER4Q')

但是得到IndexError: list index out of range。你知道吗

正确的语法是什么?我可以使用命令行api,但想使用python。你知道吗

以下是文档:https://geocoder.readthedocs.io/providers/HERE.html


Tags: 代码apiidappformatherecode地理
1条回答
网友
1楼 · 发布于 2024-04-25 01:48:45

由于您正在尝试反转地理代码,因此应添加值为'reverse'的参数method,如下所示:

geohere = here('{}, {}'.format(centroid.GetY(), 
                centroid.GetX()), 
                app_id='<app_id>', 
                app_code='<app_code>', 
                method='reverse')`

相关问题 更多 >