shw-geocoder
A minimal PyPI package that wraps the SHSMI address_search geocoding API. THIS PACKAGE IS SPECIFIC TO CERTAIN GEOCODING APIS AND IS NOT UNIVERSAL.
Install
pip install shw-geocoder
For local development:
pip install -e .
Python API
from shw_geocoder import geocode
result = geocode("your-address", "geocoder-url")
print(result["data"][0]["pointX"], result["data"][0]["pointY"])
geocode(address, base, result_count=3) returns the raw JSON returned by the
service. When the address cannot be resolved, the payload's count field is 0
and data is empty.
CLI
The package exposes a shw-geocoder command.
Single address
shw-geocoder --base "geocoder-url" \
--address "your-address"
Prints x, y, accuracy, poi, room_count to stdout.
Batch (CSV in -> CSV out + log)
shw-geocoder --base "geocoder-url" \
--input addrs.csv \
--address-column address \
--output out.csv \
--log run.log
out.csvkeeps every original column fromaddrs.csvand appends five new columns:x, y, accuracy, poi, room_count. Failed rows leave these blank.run.logis a plain-text summary containing start/end time, elapsed seconds, total / success / failed counts, and a breakdown byaccuracyvalue.
Arguments
| Flag | Required | Description |
|---|---|---|
--base |
yes | Full URL of the address_search endpoint |
--input |
batch | Input CSV path |
--address-column |
batch | Column name in the input CSV that holds the address |
--output |
batch | Output CSV path |
--log |
batch | Log file path |
--encoding |
no | Input CSV encoding (e.g. utf-8, gbk, gb18030); default utf-8 |
--address |
single | Single address to geocode (printed to stdout) |
--address and the --input group are mutually exclusive.
Metadata
Release files for shw-geocoder 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shw_geocoder-0.1.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shw_geocoder-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / shw_geocoder-0.1.0.tar.gz
| Download URL | shw_geocoder-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b55eb4a05f90d5fc83004149534eecfdfc88519e1c1e16c0c9e6a5e6ed10917
|
|
BLAKE2b-256 checksum How to use checksums |
306bdd49bae7b32aa6a48bcf981667b954b5f6c66bf375707a0fa867b49a665a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.7
|
Release files / shw_geocoder-0.1.0-py3-none-any.whl
| Download URL | shw_geocoder-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdbb4b4683a7f15b2221d350574eff2ab389343eadb3c0e87ba9c6d57ff196ca
|
|
BLAKE2b-256 checksum How to use checksums |
5d8d643eafa925a95cc1bec60ad52a300432157b1ba70bc93a1ccfecb09366f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.7
|