def download_rest_of_portland(): ways = utils.read_osm("../data/processed/ways_portland.json") nodes = utils.read_osm("../data/processed/nodes_portland.json") for way_id in list(ways.keys())[6719:]: download_street(ways[way_id], nodes, cautious=False, download=True)
def download_region(region): ways = utils.read_osm("../data/processed/ways_{}.json".format(region)) nodes = utils.read_osm("../data/processed/nodes_{}.json".format(region)) print(len(ways), "ways") for way_id in ways.keys(): download_street(ways[way_id], nodes, cautious=False, download=True)
def download_boulder(): ways = utils.read_osm("../data/processed/ways_boulder.json") nodes = utils.read_osm("../data/processed/nodes_boulder.json") print(len(ways), "ways") for way_id in ways.keys(): download_street(ways[way_id], nodes, cautious=False, download=True)
def test_portland(): ways = utils.read_osm("../data/processed/ways_portland.json") nodes = utils.read_osm("../data/processed/nodes_portland.json") # Good street # test_street("5542164", ways, nodes) # Out of portland street test_street("5293752", ways, nodes)
def test_boulder(): ways = utils.read_osm("../data/processed/ways_boulder.json") nodes = utils.read_osm("../data/processed/nodes_boulder.json") # Good street # download_street(ways['382375782'], nodes) hundred_ways = list(ways.keys())[:100] for way in hundred_ways: download_street(ways[str(way)], nodes)
def test_large_no_download(): ways = utils.read_osm("../data/processed/ways_portland.json") nodes = utils.read_osm("../data/processed/nodes_portland.json") print(len(ways)) import random for _ in range(100): way_id = random.choice(list(ways.keys())) download_street(ways[str(way_id)], nodes, cautious=False, download=False)
def test_complete_no_download(): for region in ["boulder", "pittsburgh", "seattle", "portland"]: ways = utils.read_osm("../data/processed/ways_{}.json".format(region)) nodes = utils.read_osm( "../data/processed/nodes_{}.json".format(region)) print(region, " - {} ways".format(len(ways))) for way_id in ways.keys(): download_street(ways[way_id], nodes, cautious=False, download=False)
def download_portland(): raw_data_filename = "all_of_portland.json" filtered_ways_filename = "ways.json" filtered_nodes_filename = "nodes.json" # # Uncomment these lines to re-download the data. # portland = download_osm("Portland, Oregon") # utils.write_osm(portland, raw_data_filename) # print("Data written to ", raw_data_filename) portland = utils.read_osm(raw_data_filename) ways, nodes = filter_osm(portland) print(len(portland), "elements in all of portland data") print(len(ways), "ways in all of filtered_portland data") print(len(nodes), "nodes in all of filtered_portland data") utils.write_osm(ways, filtered_ways_filename) utils.write_osm(nodes, filtered_nodes_filename)