Skip to main content

Lightweight U.S. state border lookup utilities for Python.

Project description

us-states-geo for Python

Lightweight U.S. state border lookup utilities for Python.

Install

pip install us-states-geo

Exports

  • normalize_state_input(value)
  • get_state_borders(value)
  • find_states(filters)
  • STATES
  • COUNTRIES

Usage

from border_kit import get_state_borders, find_states

texas = get_state_borders("tx")
print(texas)

isolated = find_states({"neighbor_count": {"eq": 0}})
print(isolated)

API

normalize_state_input(value)

Accepts a full state name or 2-letter abbreviation in any capitalization.

normalize_state_input("ca")          # "CA"
normalize_state_input("California")  # "CA"

get_state_borders(value)

Returns the matched state and its bordering states and countries.

find_states(filters=None)

Returns a list of states with lightweight numeric filtering.

Supported operators:

  • eq
  • ne
  • lt
  • lte
  • gt
  • gte

Example:

find_states({"neighbor_count": {"eq": 0}})
find_states({"neighbor_count": {"gte": 6}})

Development

python -m pytest

License

MIT

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

us_states_geo-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

us_states_geo-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file us_states_geo-1.0.0.tar.gz.

File metadata

  • Download URL: us_states_geo-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for us_states_geo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7ba14cda52f0d4458a4a4da82f03ab45adf9a57b64532e6fedec6e7cfe7e0787
MD5 af955e28865f1fba70ac7160fbe9dd07
BLAKE2b-256 0f204b6883e8cdefea999fdaac11e4f2b606691952a0a8c95765668644e3f0ff

See more details on using hashes here.

File details

Details for the file us_states_geo-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: us_states_geo-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for us_states_geo-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e367d03101f340ec288e41d816a24666c28a4813ef5b4ccfcba5318bea6ca52a
MD5 b9931cec238d2579b6ed7a0c1acc6744
BLAKE2b-256 55650cd1dfa0818c52dbf5e4d328eb8d975e6288c092d78c85559e5b8d56d4ad

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