Skip to main content

Geocoder client for SHSMI address_search API

Project description

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.

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

shw_geocoder-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shw_geocoder-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file shw_geocoder-0.1.0.tar.gz.

File metadata

  • Download URL: shw_geocoder-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.7

File hashes

Hashes for shw_geocoder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b55eb4a05f90d5fc83004149534eecfdfc88519e1c1e16c0c9e6a5e6ed10917
MD5 0e786d2c4e5a757f07c8029204e54568
BLAKE2b-256 306bdd49bae7b32aa6a48bcf981667b954b5f6c66bf375707a0fa867b49a665a

See more details on using hashes here.

File details

Details for the file shw_geocoder-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shw_geocoder-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.7

File hashes

Hashes for shw_geocoder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdbb4b4683a7f15b2221d350574eff2ab389343eadb3c0e87ba9c6d57ff196ca
MD5 4bd1ea980f6f78a2bc2be3c4617952a7
BLAKE2b-256 5d8d643eafa925a95cc1bec60ad52a300432157b1ba70bc93a1ccfecb09366f5

See more details on using hashes here.

Supported by

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