I am trying to do something similar to the question OSMNX - City Suburbs Polygons. The city of Panama, in the Republic of Panama, is composed of corregimientos (like a borough). I am trying to get the boroughs within the red circle with a query in OSMNX:

place_names = [
"San Felipe, Panama, Panama",
"El Chorrillo, Panama, Panama",
"Santa Ana, Panama, Panama",
"Calidonia, Panama, Panama",
"Curundu, Panama, Panama",
# "Ancon, Panama, Panama",
"Bella Vista, Panama, Panama",
"Bethania, Panama, Panama",
"San Francisco, Panama, Panama",
"Pueblo Nuevo, Panama, Panama",
"Parque Lefevre, Panama, Panama",
"Rio Abajo, Panama, Panama",


wikipedia image with Panama City boroughs

This is the plot of what is returned from that query:

plot of boroughs returned from my query

Bethania returns the information for a park in the borough. I have been editing the Open Street Relation for the neighborhood to try to get it to show up in my query without success. In the code below, the query by_osmid for Bella Vista succeeds, and the one for Bethania fails. I have been editing the relation in Open Street Map trying to fix it but haven't managed it yet. Any ideas of why that is?

# get the boundary polygon for manhattan, project it, and plot it
# city = ox.geocode_to_gdf("Manhattan, New York, USA")
# city = ox.geocode_to_gdf("Bethania, Panama, Panama")
city = ox.geocode_to_gdf(["R11381324"], by_osmid=True) # Bella Vista succeeds
city = ox.geocode_to_gdf(["R11385188"], by_osmid=True) # Bethania *fails*
city_proj = ox.project_gdf(city)
ax = city_proj.plot(fc="gray", ec="none")
_ = ax.axis("off")

Corrected boroughs image

  • Got it! The edits worked. Changed and added tags: type: multipolygon, area: yes, boundary: administrative: Nov 9, 2023 at 13:31

1 Answer 1


Got it! The edits worked. Changed and added tags in Open Street Maps:

type: multipolygon,

area: yes,

boundary: administrative.

With those edits the query managed to succeed. I had to wait a while for the updates to make a difference when queried through OSMNX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.