为什么在地理编码时反向地理编码时,我没有获得任何价值,这给了我完全相同的纬度和经度呢?

发布于 2025-02-06 06:58:51 字数 780 浏览 3 评论 0原文

我正在尝试使用反向地理编码来尝试找到州和城市。但是我没有得到某些纬度和纵向的任何结果。以下是科罗拉多州亚当斯州立大学的一个例子。我使用了研究所的名称和状态名称来获取lat and long。但是,当我使用相同的LAT和长时间反向地理编码时,结果我一无所获。如果我使用相同的nominatim(user_agent =“ myapp”),这两个为什么会发生,我该怎么办?

geolocator = Nominatim(user_agent="MyApp")

location = geolocator.geocode("Adams State University, Colorado")
Lat = location.latitude
Long = location.longitude
print('LAT: ',location.latitude)
print('LONG:', location.longitude)


LAT:  37.47480245
LONG: -105.8819230946304
geolocator = Nominatim(user_agent="MyApp")

location = geolocator.reverse("37.474802,-105.881923")
state = location.raw.get('address').get('State')
city = location.raw.get('address').get('City')
print('State: ',state)
print('City: ',city)


State:  None
City:  None

I'm trying to use reverse geocoding to try and find the state and city. But I am not getting any results for certain latitudes and longitudes. Given below is an example of Adams State University in Colorado. I used the Institute name and State name to get the Lat and Long. But when I use the same Lat and Long to reverse geocode the same I get None as the result. If I'm using the same Nominatim(user_agent="MyApp") for both why is this happening and what should I do?

geolocator = Nominatim(user_agent="MyApp")

location = geolocator.geocode("Adams State University, Colorado")
Lat = location.latitude
Long = location.longitude
print('LAT: ',location.latitude)
print('LONG:', location.longitude)


LAT:  37.47480245
LONG: -105.8819230946304
geolocator = Nominatim(user_agent="MyApp")

location = geolocator.reverse("37.474802,-105.881923")
state = location.raw.get('address').get('State')
city = location.raw.get('address').get('City')
print('State: ',state)
print('City: ',city)


State:  None
City:  None

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文