No project description provided
Project description
Whereabouts
Fast, scalable geocoding for Python using DuckDB. The geocoding algorithms are based on the following papers:
Description
Geocode addresses and reverse geocode coordinates directly from Python in your own environment.
- No additional database setup required. Uses DuckDB to run all queries
- No need to send data to an external geocoding API
- Fast (Geocode 1000s / sec and reverse geocode 200,000s / sec)
- Robust to typographical errors
Requirements
- Python 3.8+
- Poetry (for package management)
Installation
Once Poetry is installed and you are in the project directory:
poetry shell
poetry install
The current process for using Australian data from the GNAF is as follows:
- Download the latest version of GNAF core from https://geoscape.com.au/data/g-naf-core/
- Update the
setup.yml
file to point to the location of the GNAF core file - Finally, setup the geocoder. This creates the required reference tables
python setup_geocoder.py
To use address data from another country, the file should have the following columns:
Column name | Description |
---|---|
ADDRESS_DETAIL_PID | Unique identifier for address |
ADDRESS_LABEL | The full address |
ADDRESS_SITE_NAME | Name of the site. This is usually null |
LOCALITY_NAME | Name of the suburb or locality |
POSTCODE | Postcode of address |
STATE | State |
LATITUDE | Latitude of geocoded address |
LONGITUDE | Longitude of geocoded address |
Note that by default the file should be pipe-separated, i.e., use '|' as the delimitor.
Examples
Geocode a list of addresses
from whereabouts.Matcher import Matcher
matcher = Matcher(db_name='gnaf_au')
matcher.geocode(addresslist, how='standard')
For more accurate geocoding you can use trigram phrases rather than token phrases (note that the trigram option has to have been specified in the setup.yml file as part of the setup)
matcher.geocode(addresslist, how='trigram')
Once a Matcher object is created, the KD-tree for fast geocoding will also be created. A list of latitude, longitude values can then be reverse geocoded as follows
matcher.reverse_geocode(coordinates)
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
File details
Details for the file whereabouts-0.3.0.tar.gz
.
File metadata
- Download URL: whereabouts-0.3.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.14.0-1054-oem
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90e55265bff977495447d9215bd7184068fe83a1ba8d495aa41125f32eeaed5a |
|
MD5 | 4bec6224b9cf4733ca3ef0e1bcc567e6 |
|
BLAKE2b-256 | ad729d6e90c41a72cc8d3c6dee89c852fec5a0a1b7c45d95a16650e44e511bc0 |
File details
Details for the file whereabouts-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: whereabouts-0.3.0-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.14.0-1054-oem
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704439a7648b3bbe7cbed6da1cab443a4626c9e21c3ecb7f1c6ce0d884130d1e |
|
MD5 | e91b83680f2c5da60cceb557b0e0aa60 |
|
BLAKE2b-256 | ab3eb7885f8ce44b4d1b43e43b23e5676a653f2488a9bbe56ce260403eedb71d |