Skip to content

Fix numeric GeoJSON column offsets in csvjson - #1404

Open
chaser940428-pixel wants to merge 1 commit into
wireservice:masterfrom
chaser940428-pixel:fix/geojson-column-offset
Open

chaser940428-pixel wants to merge 1 commit into
wireservice:masterfrom
chaser940428-pixel:fix/geojson-column-offset

Conversation

@chaser940428-pixel

Copy link
Copy Markdown

Fixes #1403.

csvjson passed the --zero boolean directly as match_column_identifier's column offset. As a result, numeric GeoJSON selectors were zero-based by default and one-based with --zero. For example, --lat 2 --lon 3 on id,lat,lon,extra silently used lon,extra as the coordinates.

Convert the flag to the expected offset once and apply it to latitude, longitude, type, geometry, and feature ID selectors. Named selectors keep their existing behavior.

Regression tests compare complete features for named, one-based, and zero-based selections in collection, buffered-stream, and fast-stream modes, including geometry and feature ID selection, bounding boxes, and invalid index errors. Add a changelog entry.

Validation on Windows / Python 3.13.5 against the checkout:

  • PYTHONUTF8=1 python -m pytest --cov csvkit -q: 371 passed, 3 skipped, 51 subtests passed.
  • python -m flake8 ., PYTHONUTF8=1 python -m isort . --check-only, and git diff --check: passed.
  • python -m check_manifest --no-build-isolation: passed.
  • 19 additional CLI checks covering named/numeric selection, file/stdin input, collection/streaming output, and zero-based first-column selection: passed.

AI assistance was used to investigate, implement, and test this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

csvjson reverses numeric GeoJSON column indexing with --zero

1 participant