使用 geocode_to_gdf 时,是否有其他方法可以查询洛杉矶县边界而不是 OSM 的提名?

问题描述 投票:0回答:1

我正在尝试使用 OSMnx 查询洛杉矶县的开放街道地图数据。该代码适用于除洛杉矶之外的加利福尼亚州任何县。还有其他方法可以查询洛杉矶县(osmid)的数据吗?或者它根本不存在于 OSM 中吗?

我查了提名数据,没有洛杉矶县的边界数据,它只返回一个点标记。所以也许数据根本不存在(我很难相信)。

洛杉矶县提名查询https://nominatim.openstreetmap.org/ui/search.html?q=los+angeles+county

河滨县查询https://nominatim.openstreetmap.org/ui/search.html?q=riverside+county

代码:

import osmnx as ox

la_county = ox.geocode_to_gdf(
    {
        "county": "Los Angeles County",
        "state": "California",
        "country": "USA",
    }
)
type(la_county["geometry"].iloc[0])

预期结果: expected result

实际结果: actual result

openstreetmap osmnx nominatim
1个回答
0
投票

洛杉矶县存在作为 OpenStreetMap 上的边界。但Nominatim的数据库中不存在:

import osmnx as ox
ox.settings.use_cache = False
gdf = ox.geocoder.geocode_to_gdf("R396479", by_osmid=True)
# InsufficientResponseError: Nominatim geocoder returned 0 results for query 'R396479'.

过去并非如此。也许值得在 Nominatim 的 Github 存储库中提出一个问题。

© www.soinside.com 2019 - 2024. All rights reserved.