Search code examples
openstreetmaposmnx

Refence for Location Polygon names in OSMnx/OSM API


Looking through the OSMnx and OSM API documentation I haven't been able to find a reference for how to specify world place names.

The OSMnx examples use US locations, where the City, County, State, Country structure is used, but this structure doesn't apply to other countries of course.

Specifically, how should I structure this query to specify the boundary of London for instance? Or are there docs I haven't found for this yet?

G = ox.graph_from_place('London', network_type='drive')

# project the network to UTM (zone calculated automatically) then plot it
G_projected = ox.project_graph(G)
fig, ax = ox.plot_graph(G_projected)

Thanks!


Solution

  • This thread provides more detail about how to narrow your query. Long story short, use OSMnx's which_result argument and pass your place query as an explicit dict rather than a string to improve geocoder specificity.