Esempio n. 1
0
    waypoint_a=[41.9798, -87.8801], waypoint_b=[41.9043, -87.9216]
)
print(response.as_dict())

# fetches a driving route between two points
response = routing_api.car_route(
    waypoint_a=[11.0, 12.0],
    waypoint_b=[22.0, 23.0],
    modes=[RouteMode.car, RouteMode.fastest],
)
print(response.as_dict())

# fetches a pedastrian route between two points
response = routing_api.pedastrian_route(
    waypoint_a=[11.0, 12.0],
    waypoint_b=[22.0, 23.0],
    modes=[RouteMode.pedestrian, RouteMode.fastest],
)
print(response.as_dict())

# fetches a intermediate route from three points
response = routing_api.intermediate_route(
    waypoint_a=[11.0, 12.0],
    waypoint_b=[15.0, 16.0],
    waypoint_c=[22.0, 23.0],
    modes=[RouteMode.car, RouteMode.fastest],
)
print(response.as_dict())

# fetches a public transport route between two points
response = routing_api.public_transport(
Esempio n. 2
0
        # fetches a driving route between two points
        response = routing_api.car_route(
            waypoint_a=[row[1], row[2]],
            waypoint_b=[row[3], row[4]],
            modes=[RouteMode.car, RouteMode.fastest],
        )
        response = response.as_dict()
        distance_car = response['response']['route'][0]['summary']['distance']
        time_car = response['response']['route'][0]['summary']['baseTime']
        # print("car",distance_car)
        # print("car",time_car)

        # fetches a pedastrian route between two points
        response = routing_api.pedastrian_route(
            waypoint_a=[row[1], row[2]],
            waypoint_b=[row[3], row[4]],
            modes=[RouteMode.pedestrian, RouteMode.fastest],
        )
        response = response.as_dict()
        distance_walk = response['response']['route'][0]['summary']['distance']
        time_walk = response['response']['route'][0]['summary']['baseTime']
        # print("walk",distance_walk)
        # print("walk",time_walk)
        # The sql query that update data in the table with the data from API
        sql = """ UPDATE """ + schema + """.""" + table + """ 
            SET bike_distance = %s,
                bike_time = %s,
                car_distance = %s,
                car_time = %s,
                walk_distance = %s,
                walk_time = %s