Hi,
I’m not sure whether this is a bug or potential feature “request”, but I’m asking here nonetheless.
I’m using Postgres arrays (integer, text) and when I publish the layer to GeoServer, it is correctly detected, however when I query it via WFS API, it returns Java pointer to the array. It would be nice to convert it to visible representation of an array (like JSON), so instead of:
<wfs:member>
<a:table_array_test gml:id="table_array_test.4">
<a:array_column>[Ljava.lang.Integer;@54c50bfa</a:array_column>
<a:json_column>{"1": 2}</a:json_column>
</a:table_array_test>
</wfs:member>
would be: <a:array_column>[2, 1, 3]</a:array_column>
.
As for the CQL filters, function inArray
, that is listed in capabilities, just doesn’t work. Using it like: inArray(3, array_column)
just returns an error:
java.lang.ClassCastException: class org.geotools.filter.function.InArrayFunction cannot be cast to class org.geotools.api.filter.Filter (org.geotools.filter.function.InArrayFunction and org.geotools.api.filter.Filter are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @4dd8dc3)
class org.geotools.filter.function.InArrayFunction cannot be cast to class org.geotools.api.filter.Filter (org.geotools.filter.function.InArrayFunction and org.geotools.api.filter.Filter are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @4dd8dc3)
and using it like so: if_then_else(inArray(4, array_column), 1, 2) = 2
always returns false.
Why are there functions in capabilities and they aren’t documented anywhere in GeoServer documentation? Same goes for jsonArrayContains, which does work better than inArray, still it’s a hassle to use.
Is there any other way to handle array field types, specifically in CQL filters? Proper array functions would be nice. Maybe even use Postgres array functions within CQL filters?
Thanks in advance and best regards.