pygeofilter
pygeofilter copied to clipboard
to_cql2 incorrectly formats isNull args
According to the cql2 spec, the NULL predicate should look like this in cql2-json:
{
"op": "isNull",
"args": [ { "property": "geometry" } ]
}
However, if using to_cql2
to generate the json, args
is not a list:
>>> from pygeofilter.parsers.ecql import parse as parse_ecql
>>> from pygeofilter.backends.cql2_json import to_cql2
>>> to_cql2(parse_ecql("geometry IS NULL"))
'{"op": "isNull", "args": {"property": "geometry"}}'
@Ariana-B
Hmm, maybe this has changed again, but now the spec clearly depicts is as a single input. Even the example shows it so:
{ "not": { "isNull" : { "property": "geometry" } } }
This is the schema:
"isNullPredicate": {
"type": "object",
"required": [ "isNull" ],
"properties": {
"isNull": {
"$ref": "#/$defs/scalarExpression"
}
}
},
So it looks like it again should be different than our solutions.
@constantinius
It's worth noting that the most recent version of the CQL2 spec has the isNull
predicate as an array:
{
"op": "not",
"args": [
{
"op": "isNull",
"args": [ { "property": "geometry" } ]
}
]
}
I can't find a more recent version of the spec you linked, but the examples in the ogcapi-features
repo also follow this format: example 41, example 44