Skip to main content

these-united-states

A Python library for performing reverse geocoding of the United States of America.

Overview

These-united-states provides a simple, class-based interface to shapefiles from the United States Census Bureau defining boundaries of U.S. states and territories. States may be queried via full state name, abbreviation, or by coordinates (latitude/longitude pairs). State objects contain some metadata, including the bounding box, area, and polygons defining the state's boundaries.

Example

>>> import united_states

>>> us = united_states.UnitedStates()

>>> us.from_coords(29.881888, -82.726846)
[State(abbr='FL', name='Florida', bbox=BBox(left=-87.634896, bottom=24.396307999999998, right=-79.974306, top=31.000968))]

>>> us.by_abbr['WA']
State(abbr='WA', name='Washington', bbox=BBox(left=-124.848974, bottom=45.543541, right=-116.916071, top=49.002435999999996))

>>> us.by_name['Alaska']
State(abbr='AK', name='Alaska', bbox=BBox(left=-179.231086, bottom=51.175092, right=179.859681, top=71.439786))

Command-line interface

These-united-states is also usable from the command-line, with the appropriate extras installed.

$ pip install "these-united-states[cli,plot]"

$ python -m united_states 29.881888,-82.726846
(29.881888, -82.726846)  Florida

$ python -m united_states --help
Usage: united_states [OPTIONS] [POINT]...

  Lookup U.S. states by coordinate (reverse geocoding).

Options:
  -b, --bbox / --no-bbox      Print state bounding boxes in listing (implies
                              -l/--list).
  -d, --dc / --no-dc          Include the District of Columbia.
  -x, --exclude TEXT          Exclude states by abbreviation or name.
  -h, --help                  Show this message and exit.
  -i, --include TEXT          Include states by abbreviation or name.
  -l, --list / --no-list      List included states.
  -o, --oconus / --no-oconus  Include states outside the continental U.S.
  -p, --plot / --no-plot      Plot the results (requires matplotlib).
  -s, --seed FLOAT            Seed random number generator for color plot
                              selection.
  -t, --other / --no-other    Include Puerto Rico and the Island Areas.

  Options may be given multiple times. Options taking arguments are additive.
  Multiple abbreviations or names may be provided in a single option using a
  comma-separated list.

License

BSD 3-Clause license

Metadata

Release files for these-united-states 1.3.0.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for these-united-states 1.3.0.26
File Size Uploaded Provenance Actions
these_united_states-1.3.0.26.tar.gz 10.6 kB Without provenance Details for these_united_states-1.3.0.26.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for these-united-states 1.3.0.26
File Interpreter ABI Platform Actions
these_united_states-1.3.0.26-py3-none-any.whl Python 3 none any Details for these_united_states-1.3.0.26-py3-none-any.whl

Total release size: 9.9 MB

Release files / these_united_states-1.3.0.26.tar.gz

Download URL these_united_states-1.3.0.26.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
84332e0af8ee58066e17395f65d849b2da154853c3a9cffddf737355b3c137f7
BLAKE2b-256 checksum
How to use checksums
4b765d6fae09fffd15c017fb824612f4433aceab73820efe9b5971a2b3dd7684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / these_united_states-1.3.0.26-py3-none-any.whl

Download URL these_united_states-1.3.0.26-py3-none-any.whl
Size 9.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
17d67a1d66c9fb521b247560e93b126dff197c30aad68aa2f9988ccaa417b250
BLAKE2b-256 checksum
How to use checksums
fd3755a5ac96a87b88e3deed2d6bc1f91012c98327bbddfdc69814ca43464f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for these-united-states 1.3.0.26

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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