Beispiel #1
0
                            required=True)

    args = vars(arg_parser.parse_args())
    network = args['network']
    projection = args['projection']
    elevation = args['elevation']
    tif_null_value = args['null_value']
    output_dir = args['output_dir']
    ensure_dir(output_dir)

    logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.WARNING)

    logging.info('Reading in network at {}'.format(network))

    n = read_matsim(
        path_to_network=network,
        epsg=projection
    )

    logging.info('Adding elevation to network nodes')
    n.add_elevation_to_nodes(elevation_tif_file_path=elevation, null_value=tif_null_value)

    logging.info('Validating the elevation data added to network nodes')
    report = n.validation_report_for_node_elevation()
    logging.info(report)

    with open(os.path.join(output_dir, 'validation_report_for_elevation.json'), 'w', encoding='utf-8') as f:
        json.dump(sanitiser.sanitise_dictionary(report), f, ensure_ascii=False, indent=4)

    logging.info('Writing the network.')
    n.write_to_matsim(output_dir)
Beispiel #2
0
    args = vars(arg_parser.parse_args())
    network = args['network']
    schedule = args['schedule']
    vehicles = args['vehicles']
    projection = args['projection']
    processes = args['processes']
    output_dir = args['output_dir']
    ensure_dir(output_dir)

    logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.WARNING)

    logging.info('Reading in network at {}'.format(network))
    n = read_matsim(
        path_to_network=network,
        epsg=projection,
        path_to_schedule=schedule,
        path_to_vehicles=vehicles
    )

    logging.info('Simplifying the Network.')

    start = time.time()
    n.simplify(no_processes=processes)
    end = time.time()

    logging.info(
        f'Simplification resulted in {len(n.link_simplification_map)} links being simplified.')
    with open(os.path.join(output_dir, 'link_simp_map.json'), 'w', encoding='utf-8') as f:
        json.dump(n.link_simplification_map, f, ensure_ascii=False, indent=4)

    n.write_to_matsim(output_dir)