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-0.1.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-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: us_states_geo-0.1.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-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3e496353ac8c606b9ed532594c5a82106bd678adb2078868c7ae9c1bfb5435b
MD5 0f48ce9d4c8d618b36974f0f2e821c64
BLAKE2b-256 244fcd004ca5388c34849bf5cf7ed9998caf8550e53fd091464f72602209b691

See more details on using hashes here.

File details

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

File metadata

  • Download URL: us_states_geo-0.1.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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2eae2c24c9d75adc4b2ecb5846dd48433068262fea9d12bb82e18ebdf28cf4de
MD5 32cd0c28e161e7394c5258c15ccb2554
BLAKE2b-256 dfcc070f32fb0244f9bbfea6761fa9a0b875f17054229a665801de417e12fef1

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