def osm_2_gmns(): import osm2gmns as og net = og.getNetFromOSMFile('map.osm', default_lanes=True, POIs=True) og.connectPOIWithNet(net) og.generateNodeActivityInfo(net) og.consolidateComplexIntersections(net) og.outputNetToCSV(net, output_folder='consolidated') og.generateMovements(net) og.outputNetToCSV(net) og.show(net)
def mapmatch(tmc_path, osm_path): "Get the OSM Network" import osm2gmns as og files = os.listdir(osm_path) for file in files: if file[-3:] == 'osm': net = og.getNetFromOSMFile(osm_path + os.sep + file, network_type=('auto'), default_lanes=True, default_speed=True) og.consolidateComplexIntersections(net) og.outputNetToCSV(net, output_folder=osm_path) break create_folder( os.path.join(os.path.dirname(os.path.realpath('__file__')), 'data/testdata')) #to local import shutil source_link_osm = os.path.join( os.path.join(os.path.dirname(os.path.realpath('__file__')), osm_path), 'link.csv') source_node_osm = os.path.join( os.path.join(os.path.dirname(os.path.realpath('__file__')), osm_path), 'node.csv') source_trace = os.path.join( os.path.join(os.path.dirname(os.path.realpath('__file__')), tmc_path), 'trace.csv') source_list = [source_link_osm, source_node_osm, source_trace] destination_1 = os.path.join(os.path.dirname(os.path.realpath('__file__')), 'data/testdata') destination_2 = os.path.dirname(os.path.realpath('__file__')) destination_list = [destination_1, destination_2] for i in range(len(source_list)): for j in range(len(destination_list)): shutil.copy(source_list[i], destination_list[j]) MapMatching4GMNS.map_match() print("Map matching is completed!")
# -*- coding:utf-8 -*- import osm2gmns as og """ Step 1: get network from .osm file Step 2: consolidate complex intersections based on automatically identified complex intersection information Step 3: output the network with intersections consolidated """ # net = og.getNetFromOSMFile('map.osm', strict_mode=True, remove_isolated=True, simplify=True, int_buffer=18.0) # og.consolidateComplexIntersections(net) # og.outputNetToCSV(net) """ Step 1: get network from .osm file Step 2: output the network to CSV files Step 3: modify complex intersection information manually according to the network topology Step 4: load network from CSV files Step 5: consolidate complex intersections based on the modified complex intersection information Step 6: output the network with intersections consolidated """ net = og.getNetFromOSMFile('map.osm', network_type=('auto'), default_lanes=True, default_speed=True) og.outputNetToCSV(net) net = og.getNetFromCSV() og.consolidateComplexIntersections(net) og.generateMovements(net) og.outputNetToCSV(net)
import osm2gmns as og import os map_folder = r'..\maps\asu' net = og.getNetFromOSMFile(os.path.join(map_folder, 'asu.osm'), network_type=('auto', 'railway', 'aeroway'), POIs=True, default_lanes=True, default_speed=True) og.connectPOIWithNet(net) og.outputNetToCSV(net, output_folder=map_folder)
# -*- coding:utf-8 -*- import osm2gmns as og """ Step 1: get network from .osm file Step 2: consolidate complex intersections based on automatically identified complex intersection information Step 3: output the network with intersections consolidated """ # net = og.getNetFromOSMFile('map.osm', strict_mode=True, remove_isolated=True, simplify=True, int_buffer=18.0) # og.consolidateComplexIntersections(net) # og.outputNetToCSV(net) """ Step 1: get network from .osm file Step 2: output the network and automatically identified complex intersection information to CSV files Step 3: modify complex intersection information manually according to the network topology Step 4: load network from CSV files Step 5: consolidate complex intersections based on the modified complex intersection information Step 6: output the network with intersections consolidated """ net = og.getNetFromOSMFile(r'Tempe.osm', network_type=('walk'),\ POIs=True,default_lanes=True,default_speed=True) og.connectPOIWithNet(net) og.outputNetToCSV(net) # net = og.getNetFromCSV() # og.consolidateComplexIntersections(net, external_file='complex_intersection.csv') # og.outputNetToCSV(net, output_folder='consolidated')
import osm2gmns as og import os # net = og.getNetFromOSMFile('asu', network_type=('auto'), POIs=True, default_lanes = True, default_speed = True) net = og.getNetFromOSMFile('map', network_type=('railway'), POIs=True) og.outputNetToCSV(net) # check and modify (if necessary) network files before complex intersection consolidation net = og.getNetFromCSV() og.consolidateComplexIntersections(net) og.outputNetToCSV(net, output_folder='consolidated')
import osm2gmns as og net = og.getNetFromOSMFile('map.osm', network_type=('railway', 'auto', 'walk', 'bike'), POIs=True, default_lanes=True, default_speed=True) # osm2gmns supports five different network types, including auto, bike, walk, railway, aeroway. 'auto' is set as default. og.connectPOIWithNet(net) og.generateNodeActivityInfo(net) og.outputNetToCSV(net)
Input_Intermediate_Files(inter) for osmID, signal_Node in g_node_map.items(): signal_Node.PerformQEM() #Step 4: Output two signal_timing_phase Files # obtain the two jump-two files Output_Singal_Timing_Movement_Files() #Step 6: jump-three, convert the two files to timing.csv Output_Timing_File() if __name__ == '__main__': import osm2gmns as og net = og.getNetFromOSMFile('map.osm', default_lanes=True, POIs=True) og.connectPOIWithNet(net) og.generateNodeActivityInfo(net) og.consolidateComplexIntersections(net) og.outputNetToCSV(net, output_folder='consolidated') og.generateMovements(net) og.outputNetToCSV(net) og.show(net) # og.saveFig(net) Processing() # for testing # datasetPath_multi_level = r'Dataset\3_ASU_0314' # datasetPath_root = r'' # signal4gmns(datasetPath_root)