You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,26 +14,36 @@ When parsing cql2-text to cql2-json.
14
14
-`... NOT IN ...` become `NOT ... IN ...`
15
15
-`... IS NOT NULL` becomes `NOT ... IS NULL`
16
16
- Negative arithmetic operands become a multiply by -1: `{"op": "*", "params": [-1, <arithmetic_operand>]}`
17
+
- Within a Character Literal, the character (`'` or `\`) used to escape a single quote is not preserved.
18
+
- Any `''` will become `\'`
17
19
18
20
The cql2-text output from the pydantic models is opinionated and explicit. These choices have been made to keep the logic simple while ensuring the correctness of the output.
19
21
20
22
- All property names are double quoted `"`.
23
+
- Character Literals escape single quotes with a backslash `\'`.
21
24
- Parenthesis `()` are placed around all comparison and arithmetic operations.
22
-
- This means that many outputs include a set of parentheses around the whole string. While this is not ideal, it is also not incorrect. When more tests are in place, they can be used to determine if a safe and easy way exists to remove them.
25
+
- This means that many outputs include a set of parentheses around the whole string.
26
+
- This may not be not ideal, but it is also not incorrect.
27
+
- Additional testing may be done in the future to determine if a safe and easy way exists to remove them.
23
28
- Timestamps always contain decimal seconds out to 6 decimal places even when 0: `.000000`. It uses `strftime` with `%f` currently. Logic may be added later to adjust this.
24
29
- Floats ending in `.0` will include the `.0` in the text. Where other libraries such as `shapely` will not include them in WKT.
25
30
26
31
The cql2-text spec was not strictly followed for WKT. Some tweaks were made to increase it is compatible with `geojson-pydantic`, as well as accept the WKT output.
27
32
28
-
- Added optional `Z` to each geometry. It doesn't enforce 2d / 3d, just allows the character to be there.
33
+
- Added optional `Z` to each geometry.
34
+
- This does not enforce 2d / 3d, just allows the character to be there.
29
35
- LineString coordinates require a minimum of 2 coordinates.
30
-
- Added 'Linear Ring' for use in Polygons with a minimum of 4 coordinates. It doesn't enforce the ring being closed, just that it has enough coordinates to be one.
36
+
- Added 'Linear Ring' for use in Polygons with a minimum of 4 coordinates.
37
+
- This does not enforce the ring being closed, just that it contains enough coordinates to be one.
31
38
- Moved BBOX so it cannot be included in GeometryCollection.
32
-
- Moved GeometryCollection to not allow nesting, until support is added to `geojson-pydantic`.
39
+
- Added alternative MultiPoint syntax to maintain compatibility with other spatial tools and libraries.
40
+
- Allows reading of `MUTLIPOINT(0 0, 1 1)` without the inner parenthesis.
41
+
- This may be removed in the future if it is no longer necessary for compatibility. Removal will be considered a breaking change and be versioned as such.
42
+
- Note: Output will always include the inner parenthesis (via `geojson-pydantic`).
33
43
34
44
There are a few things which **may** be issues with the spec but have not been fully addressed yet.
35
45
36
-
-(Partially addressed) `spatial_literal` includes `geometry_collection` and `bbox`, and `geometry_collection` allows for all `spatial_literal` within it. But `bbox` does not seem to be a part of WKT. And at least within GeoJSON, nested `GeometryCollection` "SHOULD be avoided". This would mean the `cql2-text -> cql2-json` conversion would break where `geojson-pydantic` doesn't accept these cases.
46
+
-`spatial_literal` includes `bbox`, and `geometry_collection` allows for all `spatial_literal` within it. But `bbox` does not seem to be a part of WKT. This would mean the `cql2-text -> cql2-json` conversion would break where `geojson-pydantic` doesn't accept these cases.
37
47
- The spec does not allow for `EMPTY` geometries.
38
48
39
49
## Testing
@@ -45,7 +55,6 @@ Each file in `tests/data/json/` is a standalone cql2-json example. There will be
45
55
While 100% of the lines of code are covered, more complex examples with more nested logic will be added in the future. As well as more variety to various inputs, the current examples are mostly PropertyRef and numbers. Such as:
46
56
47
57
- More complex identifiers with `_`, `.`, `:`, and non ascii letters.
48
-
- Character literals with escaped quote.
49
58
- Deeply nested logic.
50
59
- Each type of `scalar_expression` on each side of a `binary_comparison_predicate`, etc.
0 commit comments