All Projects → kovacsbalu → Wazeroutecalculator

kovacsbalu / Wazeroutecalculator

Licence: gpl-3.0
Calculate actual route time and distance with Waze api

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Wazeroutecalculator

Jsdelivr
A free, fast, and reliable Open Source CDN for npm, GitHub, Javascript, and ESM
Stars: ✭ 4,052 (+5858.82%)
Mutual labels:  traffic
Tcpreplay
Pcap editing and replay tools for *NIX and Windows - Users please download source from
Stars: ✭ 745 (+995.59%)
Mutual labels:  traffic
Deep traffic
MIT DeepTraffic top 2% solution (75.01 mph) 🚗.
Stars: ✭ 47 (-30.88%)
Mutual labels:  traffic
Vizceral
WebGL visualization for displaying animated traffic graphs
Stars: ✭ 3,871 (+5592.65%)
Mutual labels:  traffic
Multitor
Create multiple TOR instances with a load-balancing.
Stars: ✭ 624 (+817.65%)
Mutual labels:  traffic
Stratux
Aviation weather and traffic receiver based on RTL-SDR.
Stars: ✭ 775 (+1039.71%)
Mutual labels:  traffic
Ipt Netflow
Netflow iptables module for Linux kernel (official)
Stars: ✭ 357 (+425%)
Mutual labels:  traffic
Pcapxray
❄️ PcapXray - A Network Forensics Tool - To visualize a Packet Capture offline as a Network Diagram including device identification, highlight important communication and file extraction
Stars: ✭ 1,096 (+1511.76%)
Mutual labels:  traffic
Awesome Interaction Aware Trajectory Prediction
A selection of state-of-the-art research materials on trajectory prediction
Stars: ✭ 625 (+819.12%)
Mutual labels:  traffic
Sumo
Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
Stars: ✭ 992 (+1358.82%)
Mutual labels:  traffic
Packet Agent
A toolset for network packet capture in Cloud/Kubernetes and Virtualized environment.
Stars: ✭ 419 (+516.18%)
Mutual labels:  traffic
Analytics.usa.gov
The US federal government's web traffic.
Stars: ✭ 564 (+729.41%)
Mutual labels:  traffic
Shadowsocks Hub Api
A set of open and standard restful APIs for managing shadowsocks users, servers, nodes, products, accounts, and traffic.
Stars: ✭ 25 (-63.24%)
Mutual labels:  traffic
Awesome Cybersecurity Datasets
A curated list of amazingly awesome Cybersecurity datasets
Stars: ✭ 380 (+458.82%)
Mutual labels:  traffic
Proximac
An open-source alternative to proxifier
Stars: ✭ 1,076 (+1482.35%)
Mutual labels:  traffic
Multi Camera Live Object Tracking
Multi-camera live traffic and object counting with YOLO v4, Deep SORT, and Flask.
Stars: ✭ 375 (+451.47%)
Mutual labels:  traffic
Vnstat
vnStat - a network traffic monitor for Linux and BSD
Stars: ✭ 755 (+1010.29%)
Mutual labels:  traffic
Traffic Rules Violation Detection
The System consists of two main components. Vehicle detection model and A graphical user interface (GUI)
Stars: ✭ 67 (-1.47%)
Mutual labels:  traffic
Bottyclient
A slim Discord client with many cool features including less network traffic which supports bot tokens, but user tokens theoretically work too. Tags: Discord Bot Client Token for Bot Botting Download English
Stars: ✭ 58 (-14.71%)
Mutual labels:  traffic
Phpnetmap
Web application for ethernet network mapping. PHP Software for network device monitoring with SNMP v(1/2c/3) protocol.
Stars: ✭ 20 (-70.59%)
Mutual labels:  traffic

WazeRouteCalculator

Build Status Coverage Status

Calculate actual route time and distance with Waze API.

Installation

pip install WazeRouteCalculator

Tested on Python 2.7 and 3.5, 3.6, 3.7

Example

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Budapest, Hungary'
to_address = 'Gyor, Hungary'
region = 'EU'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region)
route.calc_route_info()
python example.py
From: Budapest, Hungary - to: Gyor, Hungary
Time 69.27 minutes, distance 120.91 km.

calc_route_info returns a tuple (route_time, route_distance) in addition to logging.

from_address and to_address are required. The address can also be coordinates. region is optional, and defaults to "EU". region can be one of:

  • EU (Europe)
  • US or NA (North America)
  • IL (Israel)

Region is used for address searching. Setting base coord parameter. (Removed from route server selection. Looping through all route servers.)

Vehicle types

vehicle_type is also optional, and defaults to "" which is private. vehicle_type can be one of:

  • TAXI
  • MOTORCYCLE

Time to destination will be adjusted based on the mode of transport.

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Budapest, Hungary'
to_address = 'Gyor, Hungary'
region = 'EU'
vehicle_type = 'MOTORCYCLE'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region, vehicle_type)
route.calc_route_info()
python example.py
From: Budapest, Hungary - to: Gyor, Hungary
Time 112.92 minutes, distance 124.93 km.

Avoid toll roads

avoid_toll_roads is also optional, and defaults to False. Setting avoid_toll_roads to True will only return results not on a tollway.

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Chicago, Illinois'
to_address = 'New York City, New York'
region = 'US'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region, avoid_toll_roads=True)
route.calc_route_info()

Avoid subscription roads (vignette system)

avoid_subscription_roads is also optional, and defaults to False. Setting avoid_subscription_roads to True will only return results not involving a subscription road (toll roads in coutries that use vignettes).

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Long Branch, New Jersey'
to_address = 'New York City, New York'
region = 'US'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region, avoid_subscription_roads=True)
route.calc_route_info()

Avoid ferries

avoid_ferries is also optional, and defaults to False. Setting avoid_ferries to True will only return results not involving a ferry.

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Long Branch, New Jersey'
to_address = 'New York City, New York'
region = 'US'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region, avoid_ferries=True)
route.calc_route_info()

Multiple routes

You can get multiple routes using the route.calc_all_routes_info() function:

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Budapest, Hungary'
to_address = 'Gyor, Hungary'
region = 'EU'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region)
route.calc_all_routes_info()
python example.py
From: Budapest, Hungary - to: Gyor, Hungary
Time 74.45 - 129.43 minutes, distance 120.91 - 130.08 km.

calc_all_routes_info takes an optional single parameter, the number of routes to fetch. Note that the Waze API may not return as many possibilities as requested. The function returns a dict: {'route_name1': (route_time1, route_distance1), 'route_name2': (route_time2, route_distance2), ...}.

No real time

You can pass real_time=False to calc_route_info or calc_all_routes_info to get the time estimate not including current conditions, but rather the average travel time for the current time. This would avoid something like traffic accidents or construction that is slowing down traffic abnormally on the day you run it from messing up the data. Note that this is not the same as travel time with no traffic at all, it is simply the usual traffic.

Intercity travel times only

Sometimes you may want to map travel times between cities and just see how long it takes to get from one to other. However, Waze's API will take you between two specific spots in the city, which can add to the time and distance, especially in larger cities.

You can pass stop_at_bounds=True to calc_route_info or calc_all_routes_info and it will ignore travel within the origin and destination cities.

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Budapest, Hungary'
to_address = 'Gyor, Hungary'
region = 'EU'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region)
From: Budapest, Hungary - to: Gyor, Hungary

route.calc_route_info(stop_at_bounds=True)
Time 46.27 minutes, distance 95.29 km.

route.calc_route_info()
Time 72.42 minutes, distance 121.33 km.

Leave at

You can pass time_delta=<int> to calc_route_info or calc_all_routes_info to set the leave time from now. The value is between 0 (now - default) and 1440. The following example shows route info from now + 60 minute.

import WazeRouteCalculator

logger = logging.getLogger('WazeRouteCalculator.WazeRouteCalculator')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
logger.addHandler(handler)

from_address = 'Budapest, Hungary'
to_address = 'Gyor, Hungary'
region = 'EU'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region)
From: Budapest, Hungary - to: Gyor, Hungary

route.calc_route_info(time_delta=60)
Time 73.33 minutes, distance 120.92 km.

No logging

log_lvl argument is depricated.

import WazeRouteCalculator

from_address = 'Budapest, Hungary'
to_address = 'Gyor, Hungary'
region = 'EU'
route = WazeRouteCalculator.WazeRouteCalculator(from_address, to_address, region)
route_time, route_distance = route.calc_route_info()
print 'Time %.2f minutes, distance %.2f km.' % (route_time, route_distance)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].