Calculate distances between 2 addresses, Distances Calculator is based on open street map api.
Project description
Distances Calculator
This is a distance calculator between 2 addressed, it is based on openstreetmap api.
Getting start
- install,
pip install distances-calculator
- uninstall
pip uninstall distances-calculator
get distance between 2 addresses
2 parameters,
- address 1
- address 2
distances-calc "125 Queen St, Auckland, 0620" "127 Queen St, Auckland, 0620"
calculate the distance between a table's data
2 parameters,
- address, the center, the original address
- path, the absolute path of your csv file
distances_writer "125 Queen St, Auckland, 0620" "/home/Username/test.csv"
example of distance_writer
table test.csv
id | address |
---|---|
0 | 1 Fontenoy Street, Mount Albert, Auckland 1025 |
1 | 3A Fontenoy Street, Mount Albert, Auckland 1025 |
after running distances_writer "125 Queen St, Auckland, 0620" "/home/Username/test.csv"
new table test.csv will be
id | address | distance_to_139 Carrington Rd, Mount Albert, Auckland 1025 |
---|---|---|
0 | 1 Fontenoy Street, Mount Albert, Auckland 1025 | 0.447789551786935 |
1 | 3A Fontenoy Street, Mount Albert, Auckland 1025 | 0.471488332032505 |
P.S.
in your csv table, there should be one column named address
, and the writer can create a new column named distance_to_<address>
How to calculate distance
Based on coordinate
Earth is a sphere, so we can use simple triangle function to calculate a not accurate distance, but most of time, this direct distance is good enough.
Based on open street map api (in future)
this can be used to calculate route distance.
API
- extract_coordinate
- get_distance
- write_into
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for distances_calculator-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11c2d28ef5335bfd76e5803a40962419e2ce95f821d1f3edbc9eaae619216179 |
|
MD5 | 8aec5e199ee2bd6a133ae17759b86b70 |
|
BLAKE2b-256 | 71760547b1c0de57a3382fb7c07050758395a5fe960188b82df49b25269f4f6b |
Hashes for distances_calculator-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d20e4b626d1b1858c094ee345aa2ce3f43ca8d2f36deff17098cd67ede08f80b |
|
MD5 | 4f8dda3b8c0a1138bf875e543a3a0cc0 |
|
BLAKE2b-256 | 31f6d5410750664787e8ea5924ecd2af18af1912015e94fee92f9a2005458d30 |