osm_analyzer/xmlparser.py

17 lines
523 B
Python
Raw Normal View History

2020-07-09 11:17:22 +02:00
#!/usr/bin/python3
import osmnx as ox
import json
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
osm_file = config['SHARED']['basepath'] + config['XMLPARSER']['osm_file']
json_file = config['SHARED']['basepath'] + config['SHARED']['json_file']
print('converting osm file, this takes very long!')
osm_data = ox.overpass_json_from_file(osm_file)
print("writing to file, this will take some time!")
with open(json_file, 'w') as writefile:
json.dump(osm_data, writefile)
print("done")