Created
July 31, 2016 16:37
-
-
Save Zia-/b8d2241c85406d7250e205e1864f304a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from xml.dom import minidom | |
proj_dir = "/Users/zia/Documents/journals/My_WriteUp/Terrain_Routing_New/osm_data_downloaded/singaporeMalaysia/numberOfNodesPerRoad" | |
rel_file_path = "osm.osm"; | |
abs_file_path = os.path.join(proj_dir, rel_file_path) | |
result_rel_file_path = "numberOfNodesPerRoad.csv" | |
result_abs_file_path = os.path.join(proj_dir, result_rel_file_path) | |
xmldoc = minidom.parse(abs_file_path) | |
way = xmldoc.getElementsByTagName("way") | |
f = open(result_abs_file_path, 'w') | |
for w in way: | |
nd = w.getElementsByTagName("nd") | |
f.write(str(len(nd))) | |
f.write("\n") | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment