fix(cql2_json): accept BETWEEN with flat args per final spec - #175
Open
C1-BA-B1-F3 wants to merge 3 commits into
Open
C1-BA-B1-F3 wants to merge 3 commits into
C1-BA-B1-F3 wants to merge 3 commits into
Conversation
The unquoted attribute regex /[a-zA-Z][a-zA-Z_:0-9.]+/ required at least two characters, so expressions like 'a = 1' or 'S_INTERSECTS(g, BBOX(...))' failed to parse. Change the trailing .+ to .* so a single-letter identifier is accepted. Fixes geopython#165
A GeoJSON bbox literal is [minx, miny, maxx, maxy], but parsers/cql2_json/parser.py unpacked it directly into values.Envelope(*bbox) whose field order is (x1, x2, y1, y2) == (minx, maxx, miny, maxy). The two conventions were conflated, so longitudes and latitudes were silently swapped. Reindex explicitly: Envelope(b[0], b[2], b[1], b[3]). Fixes geopython#163
OGC 21-065r2 defines BETWEEN with a flat 3-element args array [operand, low, high]. The parser only accepted the draft nested shape [operand, [low, high]], so a spec-conformant client raised TypeError. Accept both: nested when args[1] is a list, flat when it is not. Fixes geopython#162
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.
Summary
OGC 21-065r2 (the final CQL2 standard) defines BETWEEN with a flat 3-element
argsarray:{"op": "between", "args": [{"property": "height"}, 2, 5]}parsers/cql2_json/parser.pyonly accepted the draft nested shapeargs[1][0]/args[1][1]:A spec-conformant client's BETWEEN therefore raised
TypeError: 'int' object is not subscriptable.Fix
Accept both shapes: nested when
args[1]is a list, flat when it is not.Test plan
test_between_flat_args_final_specandtest_between_nested_args_draft_compatcover both shapes.pytest tests/parsers/cql2_json/— 45/45 pass (43 pre-existing + 2 new).Fixes #162