pyrosm icon indicating copy to clipboard operation
pyrosm copied to clipboard

Error when modifying the example code for Basic Usage:Read street networks

Open brunobelorte opened this issue 1 year ago • 0 comments

Describe the bug Well, I did a test using the tutorial presented on the page "Read street networks" and, when opening the sudeste-latest.osm.pbf file, I received an error from the library

To Reproduce Steps to reproduce the behavior:

from pyrosm import OSM
from pyrosm import get_data

fp = get_data("sudeste", directory="/home/brunob/mapas")


osm = OSM(fp)

drive_net = osm.get_network(network_type="driving")
drive_net.plot()

and so

 Traceback (most recent call last):
 File "/home/brunob/códigos/plotando_mapa.py", line 18, in <module>
 drive_net = osm.get_network(network_type="driving")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/brunob/.local/lib/python3.11/site-packages/pyrosm/pyrosm.py", line 249, in get_network
 edges, node_gdf = get_network_data(
                       ^^^^^^^^^^^^^^^^^
File "/home/brunob/.local/lib/python3.11/site-packages/pyrosm/networks.py", line 18, in get_network_data
nodes, ways, relation_ways, relations = get_osm_data(
                                            ^^^^^^^^^^^^^
File "pyrosm/data_manager.pyx", line 175, in pyrosm.data_manager.get_osm_data
File "pyrosm/data_manager.pyx", line 176, in pyrosm.data_manager.get_osm_data
File "pyrosm/data_manager.pyx", line 172, in pyrosm.data_manager._get_osm_data
File "pyrosm/data_manager.pyx", line 130, in pyrosm.data_manager.get_osm_ways_and_relations
File "pyrosm/data_manager.pyx", line 95, in pyrosm.data_manager.get_way_arrays
File "pyrosm/_arrays.pyx", line 93, in pyrosm._arrays.convert_to_arrays_and_drop_empty
File "pyrosm/_arrays.pyx", line 79, in pyrosm._arrays.convert_to_arrays_and_drop_empty
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Expected behavior The expected behavior was to plot the highway map

Environment:

  • OS: Ubuntu 22.04.3 LTS (GNU/Linux 6.5.0-18-generic x86_64)
  • Python package source
  • python 3.11.5, pyrosm 0.6.2, osmnx 1.9.1

brunobelorte avatar Mar 01 '24 00:03 brunobelorte