Geographic Information Systems Asked by GiuseppeBrenk on March 25, 2021
I’d like to extract, given a city name, all suburbs and relative polygon geometries. For instance:
https://nominatim.articque.com/details.php?place_id=230259366
So, I run the code:
place = 'Torino, Italia'
tags = {'place':'suburb'}
gdf = ox.geometries_from_place(place, tags)
When reading gdf content, some suburbs have been stored as polygons (what I wanted), but some others have been stored as points. The one in the previous picture, for instance, belongs to the latter group.
unique_id node/6173683209
osmid 6173683209
element_type node
geometry POINT (7.6801517 45.0549503)
name San Salvario
place suburb
reg_name NaN
wikidata NaN
wikipedia NaN
name:pms NaN
nodes NaN
ways NaN
description NaN
type NaN
Name: 14, dtype: object
While others, as already mentioned, are polygons, just like this one.
unique_id relation/9169020
osmid 9169020
element_type relation
geometry POLYGON ((7.6628873 45.068484, 7.663573 45.069...
name Centro
place suburb
reg_name NaN
wikidata NaN
wikipedia NaN
name:pms NaN
nodes [[[13929743, 1669480276, 538902963], [53890296...
ways [160600494, 572748521, 134148111, 111863124, 1...
description Confini dell'ex Quartiere 1 della divisione a 23.
type multipolygon
Name: 41, dtype: object
How can I get all suburbs as Polygons?
From what I understand, this node is what you are currently getting, but this relation is what you actually want. On OSM, the San Salvario place:suburb is represented as a node but its boundary is represented as a relation comprising its center (the node linked above) plus the set of ways making up its outer polygon.
Currently, the OSMnx geometries
module only handles OSM relations of type multipolygon. As we're not currently handling boundary relations, we get some inconsistent effects. For example, in Turin this suburb's boundary is represented as a multipolygon relation but this suburb's boundary is represented as a boundary relation.
I've opened a proposal at the OSMnx Github repo to fix this. Comments welcome.
Answered by gboeing on March 25, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP