lieblerj / poi_converter

Convert openandromaps poi databases into Locus osm.db format
Apache License 2.0
7 stars 3 forks source link

V0.6 crashes when processing .pbf-files #7

Closed Tiemichael closed 4 years ago

Tiemichael commented 4 years ago

When I try to process a .pbf-file the app crashes:

(poi_converter-0.6.0-aOPahR95) C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0>python poiconverter.py -if pbf -om create SGP27122019.pbf SGP27122019a.osm.db
Preparing database, please wait ... finished!
Adding POIs ...
Traceback (most recent call last):
  File "poiconverter.py", line 65, in <module>
    main()
  File "poiconverter.py", line 58, in main
    importer.apply_file(arguments.input_file)
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\fileimporter.py", line 24, in node
    self.handle_node(node)
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\fileimporter.py", line 21, in handle_node
    self.callback(poi)
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\poiwriter.py", line 89, in write_poi
    self.db.write_poi(poi)
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\database.py", line 98, in write_poi
    self.write_pois()
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\database.py", line 106, in write_pois
    self.insert_pois(pois_with_ids)
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\database.py", line 62, in insert_pois
    self.cursor.executemany(sql, iterator(pois_with_ids))
  File "C:\Users\Michael\Downloads\poi_converter-0.6.0\poi_converter-0.6.0\poiconverter\database.py", line 59, in iterator
    yield [id, poi.node_id, poi.osm_type, poi.name, "POINT({} {})".format(poi.lon, poi.lat)]
AttributeError: 'Poi' object has no attribute 'osm_type'

I was able to fix this crash by adding: poi.set_osm_type(getattr(poi, 'osm_type', 'P')) after ln 88 in poiwriter.py