Skip to main content

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.

APIxcode

  • extract_coordinate
  • get_distance
  • write_into

Links About

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

distances_calculator-0.1.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

distances_calculator-0.1.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file distances_calculator-0.1.3.tar.gz.

File metadata

  • Download URL: distances_calculator-0.1.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for distances_calculator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c09516cb38d7ee546eaf3bbf606e8d15202634f573b01d01105d4232bc0aceb1
MD5 19d9fac11e2bbd41247a3682e593bd66
BLAKE2b-256 f7989dc841242987a0e75fd82711adc63b1c2b40cb6667faa35f57185767a594

See more details on using hashes here.

File details

Details for the file distances_calculator-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: distances_calculator-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for distances_calculator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ce48e6fa61f2cc50680142959853300462579b5d6ef209d1181e3227b4e1839a
MD5 da8e2412b2b0576fe695b58ff0b0a3bf
BLAKE2b-256 3d2ed8b42b288914387464d8f25ec2025da4ce94151eb6cb6f82fe5c4e159609

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page