- Start with
description.mdfor product intent, thenREADME.mdfor the actual implemented workflow and user-facing behavior. - The repo goal is a Python-only GeoJSON tiler that chunks large GeoJSON datasets into XYZ tile files.
- Keep the project beginner-friendly: when behavior changes, update
README.mdwith copy-pasteable commands and concrete examples.
- Source code lives under
src/geojson_tiler/with a small, explicit module split:geojson.py: load/normalize GeoJSON, validate supported geometry types, extract boundsxyz.py: Web Mercator / XYZ tile math (lonlat_to_tile,tile_bounds,tiles_for_bounds)tiler.py: main tiling pipeline; duplicates each feature into every intersecting tile across a zoom rangewriter.py: writesz/x/y.geojsonplusmetadata.jsoncli.py: argparse-based CLI and error handling
- The public package entrypoints are
geojson-tilerandpython -m geojson_tiler.
- This implementation is bbox-based tiling, not geometry clipping. A polygon/line is written in full to every intersecting tile.
nullgeometries are allowed and skipped during tile generation.- The tool accepts a top-level GeoJSON
FeatureorFeatureCollection; single features are normalized into aFeatureCollectioninternally. - Output always includes
metadata.jsonsummarizing the source filename, total input feature count, tile count, and written tile paths.
- Set up the project with:
python -m venv .venvsource .venv/bin/activatepython -m pip install -e ".[dev]"
- Run tests with
python -m pytest. - Coverage is intentionally strict:
pyproject.tomlconfig requires 100% coverage forgeojson_tiler. - After changing runnable behavior, smoke-test the CLI, not just unit tests; the README quickstart commands should remain accurate.
- Prefer the standard library over extra GIS dependencies unless the added complexity clearly pays off; the current implementation has no runtime dependencies.
- Keep file output predictable and static-host-friendly: tile files live at
OUTPUT/z/x/y.geojson. - When expanding the tiler, preserve the current documented semantics or update
README.mdand tests in the same change. .gitignoreignoresdescription.md; treat it as local product-spec context unless the user asks to track it.
- Tests live in
tests/and currently cover CLI behavior, GeoJSON validation, XYZ math, tiling logic, writing, and module entrypoint import. - Prefer small inline GeoJSON fixtures in tests unless a file fixture makes the behavior clearer.
- If you add a new module under
src/geojson_tiler/, add direct tests for every error path; the repo is configured to fail below 100% coverage.