Skip to main content

Build, validate, and index web-optimized GeoJSON precinct, school district, etc. files for state repos

Project description

civic-geo-generator

PyPI Python versions License: MIT CI Status Docs

Lightweight CLI and library to build web-optimized GeoJSON for election precincts (and similar layers).
Outputs three artifacts per run:

  • full GeoJSON (QA and reproducibility)
  • web GeoJSON (served to apps)
  • TopoJSON (optional, for smaller delivery)

It also writes per-version metadata.json, and a state index.json that points to the latest layer.

Installation

pip install civic-geo-generator

Quick start

# install deps
uv sync --extra dev --extra docs --upgrade

# orchestrated runs based on yaml file
uv run civic-gen run -f inputs.yaml

# or provide a specific state and view
uv run civic-gen run MN precincts

Conventions

  • Batch inputs live in inputs.yaml.
  • Config files live under data-config/ (e.g., us/mn/precincts.yaml).
  • Data input files should be placed in the data-in folder, organized by state and layer as described in YAML configs (e.g., data-config/us/mn/precincts.yaml).
  • Outputs are written under data-out/us/<state-name>/<view>/<version>/.

Links


Pipeline

Place statewide GeoJSON input in correct location, e.g.

  • data-in/us/mn/precincts_2025-04.json

Configure inputs.yaml, e.g.

# inputs.yaml  (batch mode)
runs:
  - state: MN
    views: [precincts]
    version_overrides:
      precincts: "2025-04"
# 1) Build (copy/normalize/add snapshot metadata)
civic-gen build --version 2025-04

# 2) Validate (CRS, required columns, geometry, basic uniqueness)
civic-gen validate --version 2025-04

# 3) Index (flat index, manifest, state layer pointers)
civic-gen index

Development

See DEVELOPER.md

Available: Minnesota Precincts

They include voting precinct boundaries as well as the name, county, and election districts (US Congress, MN Senate and House, County Commissioner) for each precinct.

Geojson files are intended to provide basic information regarding the location of election districts within the state. For the most accurate information on precincts and districts, as well as polling place information, please use the Polling Place Finder.

Minnesota precincts - April 2025 (6225 KB json)

Congressional District as of April 2025
District 1 (southern Minnesota) C.D. 1 (1062 KB json)
District 2 (south Metro) C.D. 2 (383 KB json)
District 3 (greater Hennepin County) C.D. 3 (341 KB json)
District 4 (Ramsey County and suburbs) C.D. 4 (217 KB json)
District 5 (Minneapolis and suburbs) C.D. 5 (171 KB json)
District 6 (northwestern Metro, St Cloud area) C.D. 6 (578 KB json)
District 7 (western Minnesota) C.D. 7 (1760 KB json)
District 8 (northeastern Minnesota) C.D. 8 (1720 KB json)

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

civic_geo_generator-0.1.2.tar.gz (169.6 kB view details)

Uploaded Source

Built Distribution

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

civic_geo_generator-0.1.2-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file civic_geo_generator-0.1.2.tar.gz.

File metadata

  • Download URL: civic_geo_generator-0.1.2.tar.gz
  • Upload date:
  • Size: 169.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for civic_geo_generator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33b77a644283b8f9564d142d4a8867c9e3ec9a9718ed63d641ab21f1d01ba9b2
MD5 db5a4b1e40db9f6fb8871330cc0b3fde
BLAKE2b-256 d9299d7b79a1bf282b5418b76ef9cd8705daa64badd41e9cb583c863d8949212

See more details on using hashes here.

Provenance

The following attestation bundles were made for civic_geo_generator-0.1.2.tar.gz:

Publisher: release.yml on civic-interconnect/civic-geo-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file civic_geo_generator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for civic_geo_generator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c79f8816773a8129022fac46bfd4f47108a5af583517be002994ff6732f661d
MD5 9b200a7521792db895c464981ef44e01
BLAKE2b-256 082474d6322f6d58ca072d83d986d8e0e77cd9d386f7dc62d340eb862bc5ac85

See more details on using hashes here.

Provenance

The following attestation bundles were made for civic_geo_generator-0.1.2-py3-none-any.whl:

Publisher: release.yml on civic-interconnect/civic-geo-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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