我正在尝试使用 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])
洛杉矶县存在作为 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 存储库中提出一个问题。