Skip to main content

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.csv keeps every original column from addrs.csv and appends five new columns: x, y, accuracy, poi, room_count. Failed rows leave these blank.
  • run.log is a plain-text summary containing start/end time, elapsed seconds, total / success / failed counts, and a breakdown by accuracy value.

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)

Source distribution for shw-geocoder 0.1.0
File Size Uploaded
shw_geocoder-0.1.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shw-geocoder 0.1.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page