2

I'm using OSmnx to create some nice maps where I color streets based on the name of the street, inspired by puntofisso (eg: if it's a street, it needs to be red, a lane is green, etc). I noticed that sometimes the name of an edge is not a string, but a list instead. I worked around that so far, but is there an argument that could solve this? Or is it caused by something in OpenStreetMap? I was unsuccessful in googling for answers unfortunately.

test_place='Kerkstraat, Delft'
# Create a graph around this address
G3 = ox.graph_from_address(test_place, network_type='all',dist=100, dist_type='bbox')
edge_attributes3 = ox.graph_to_gdfs(G3, nodes=False)
edge_attributes3.head(50)

This gives [Markt, Kerkstraat] in the name column in the row with index 2. My solution now just takes the first element of the list, but I wanted to find the Kerkstraat in Delft and it turns out that the Kerkstraat only occurs in edges that have a list for their name.

Any help is greatly appreciated!

Sanne Hombroek
  • 105
  • 1
  • 6

1 Answers1

1

Given the arguments you passed to graph_from_address, you've left the simplify=True default parameterization. Therefore your graph was simplified when created. From the docs on simplification:

Some of the resulting consolidated edges may comprise multiple OSM ways, and if so, their multiple attribute values are stored as a list.

gboeing
  • 5,691
  • 2
  • 15
  • 41
  • Excellent, that fixed it, thanks! Thought I tried to change simplify parameter but I probably only tried simplify=True (which I see now is the default..) – Sanne Hombroek Jan 03 '21 at 23:08