Repository navigation
Add --ids to osm_planet_extract to cut selected extents - #49
Merged
Merged
Conversation
--csv, --geojson and --poly cut every extent in the file. --ids takes a comma-separated list of names and cuts only those, failing on any name not in the file so a typo does not quietly produce nothing. This lets users reproduce individual OSM Extracts regions from the osm-extracts cities.json now that the hosted service is winding down (interline-io/tilecutter#51). Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
--ids= bypasses validation and unexpectedly extracts every extent.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds selective extent extraction via comma-separated --ids.
Changes:
- Filters GeoJSON, CSV, and poly extents by ID.
- Reports unknown or empty IDs before extraction.
- Documents usage and adds tests.
| File | Description |
|---|---|
planetutils/osm_planet_extract.py |
Implements --ids filtering. |
tests/test_extract_ids.py |
Tests selection and validation behavior. |
README.md |
Documents selective extraction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Toward interline-io/tilecutter#51. With OSM Extracts winding down, users need a way to cut a single region themselves.
--csv,--geojsonand--polycut every extent in the file, so reproducing one OSM Extracts region from the 149-featurecities.jsonmeant hand-editing the file.--idstakes comma-separated names and works with any extents file.cities.jsonfrom osm-extracts and cut regions from it. I left out a flag that downloads it automatically, so PlanetUtils doesn't depend on that repo staying put.Testing
tests/test_extract_ids.pycovers GeoJSON, CSV, position-keyed features, whitespace, unknown ids and empty--ids.ruff checkis clean.examples/san-francisco-downtown.osm.pbfand the livecities.json:--ids=us-ca,san-francisco_californiawrote both PBFs, and--ids=us-calexited 2 without extracting anything.🤖 Generated with Claude Code