Skip to content

This project calculates the nearest truck to load cargo from a given geographic decimal coordinate pair

Notifications You must be signed in to change notification settings

nandoabreu/geo-coordinate-calc-and-pandas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geo coordinate calculation (using pandas)

This task returns a list of trucks best located to be assigned to a cargo, based on geo coordinates from both, cargo and truck. This project was developed using Python 3.8 over Ubuntu Linux and tested with git clone into a Windows10 VirtualBox with Python 3.7.

 
 

README Map

Set-up and install

I recommend using virtualenv.

Install the requirements:

$ python3 -m pip install -r requirements.txt

Please check the config file to personalise variables as needed.

Automatic tests

Note: to run tests manually, please refer to Set-up and install first. Note: to run tests using Makefile, virtualenv must be already installed.

Python tests are available manually or using Makefile.

  • Run python3 -m unittest tests/test_*.
  • Or use make as in make test to setup, run the tests and clean up.

The Truck class

Note: to run from Python console, please refer to Set-up and install first.

With the python console and the Truck class, we can get three best recommended trucks to transport a cargo, from the cargo's latitude and longitude:

$ python3
>>> from truck import Truck
>>> t = Truck()
>>> t.locate(36.876719, -89.5878579)

Run from command line

Note: to run from command line, please refer to Set-up and install first.

From the project's root directory, please run the following command and follow instructions:

$ python3 -m truck

ATTENTION: To print all cargo and each optimal truck, use the MENU option all.

Logs

By default, logs are recorded in the 'logs' directory, in the project's root.

Please see docs/logs if you wish to access samples of the generated logs.

Documentation

Please try from command line:

$ python3 -c 'import config; help(config)'

Or try from python console:

$ python3
>>> import truck
>>> help(truck)

All documentation can be found in docs.

To do

  • Preview distance between truck and load.
  • Preview distance between cargo get and deliver point.
  • Preview distance between truck and deliver.
  • Configure rotation of log files.
  • Improve docstrings.