Skip to content

VShkaberda/Routes_calculation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Routes_calculation

Calculate routes (distance, travel time) between geographic points using API.

  • db_connect.py - connects to SQLite database;
  • geoYN.py - contains functions to work with API and main work cycle;
  • routes_calc.py - starting module for initialization.

db_connect_sql.py

Module to work with database.

class DBConnect() - establishes connection to database.

Uses methods:

count_empty_rows() - returns number of point pairs that have to be updated.

raw_query(query) - executes query and returns result.

empty_dist() - returns info about the next pair of points.

update_dist(id_, km_time) - uploads to server info contained in km_time. Updates row with corresponding id_.

geoYN.py

Module to work with API and transfer data between functions.

Uses functions:

not_valid_response(text) - checks text of responce for errors.

get_km_time(n, latA, lonA, latB, lonB, id_) - asks API for distance and time between point with coordinates (latA, lonA) and point with coordinates (latB, lonB). n - parameter for API, id_ - current row id for log error.

geoYN(args, db_params) - main cycle that requests server, API and transfers data between them.

routes_calc.py

Main module that makes checks and initializes parameters.


Usage: routes_calc.py with parameters. Use --help for additional information.

Be sure to setup config.ini.


Requirements


Update history

  • 1.04 - Fixed connection issues.
  • 1.03 - Deleted final Input, because program is intended to be used from cmd/terminal with arguments.
  • 1.02 - Added timeout parameter to handle situation if server has not issued a response.
  • 1.01 - Release version.

About

Calculate routes (distance, travel time) between geographic points using API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages