Skip to content

fix(values): correct Envelope.from_bbox axis order - #174

Closed
C1-BA-B1-F3 wants to merge 1 commit into
geopython:mainfrom
C1-BA-B1-F3:fix/cql2-json-bbox-axis-order
Closed

C1-BA-B1-F3 wants to merge 1 commit into
geopython:mainfrom
C1-BA-B1-F3:fix/cql2-json-bbox-axis-order

Conversation

@C1-BA-B1-F3

@C1-BA-B1-F3 C1-BA-B1-F3 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GeoJSON bbox order is [minx, miny, maxx, maxy], but the old from_bbox treated the second half as starting at index len//2, producing scrambled coordinates. The 3D bbox (6 elements) had the same issue.

Fix

Rewrite Envelope.from_bbox to explicitly unpack (minx, miny, maxx, maxy) from 4-element and (minx, miny, minz, maxx, maxy, maxz) from 6-element bbox arrays.

Changes from previous version

  • Removed all unrelated changes (cql2_text attribute regex, etc.)
  • Moved fix to values.py where it belongs (instead of patching the parser)
  • 71/71 cql2_json tests pass

Fixes #163

@C1-BA-B1-F3

Copy link
Copy Markdown
Contributor Author

Merged current main into this branch so it is mergeable again. The only conflict was tests/parsers/cql2_text/test_parser.py: upstream's NOT/paren precedence tests (#170, #171) and this stack's single-letter attribute tests were added at the same spot. Both sets are kept — no change to the fix itself. tests/parsers/cql2_text + tests/parsers/cql2_json: 103 pass.

GeoJSON bbox order is [minx, miny, maxx, maxy], but the old code
treated the second half as starting at index len//2, which scrambled
longitudes and latitudes. 3D bbox (6 elements) had the same issue.

Fixes geopython#163
@C1-BA-B1-F3
C1-BA-B1-F3 force-pushed the fix/cql2-json-bbox-axis-order branch from 0bf2c6a to 13cf609 Compare October 6, 2026 15:43
@C1-BA-B1-F3 C1-BA-B1-F3 changed the title fix(cql2_json): correct Envelope axis order for bbox literals fix(values): correct Envelope.from_bbox axis order Oct 6, 2026
@constantinius

Copy link
Copy Markdown
Contributor

This was already fixed with #172
Thanks anyways!

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.

cql2-json: {"bbox": ...} literals scramble axes through values.Envelope field order

2 participants