4

I have a database table with a dynamic schema implemented via a JSON column named "properties".

Currently GeoServer doesn't recognize my JSON column.

Is there some way to make Geoserver recognize the column?

Or may be if it doesn't work with JSON, is there some way to make it work with HSTore?

I need the properties JSON column to be rendered in the properties of a WFS response, also I need to apply several dynamic CQL_FILTER to the "properties" column.

1

GeoServer supports neither, there is a discussion ongoing on how to implement support for HSTORE here: http://osgeo-org.1560.x6.nabble.com/Re-Geoserver-Question-about-PostgreSQL-and-JSON-or-HStore-td5218145.html

Supporting JSON columns would be quite a bit more complicated.

6

For those wondering, at version 2.13.0, GeoServer started supporting HStore and JSON columns for PostGIS data stores. The site says:

The PostGIS data store now has simple support for HStore and JSON columns. HStore is returned as a Map and will render as a JSON formatted string field in common WFS output formats, while JSON is read as a string and rendered as-is. In both cases no special query support has been added for those types (but we’d be very happy if someone would work, or sponsor, that functionality too).

  • Indeed since 2.13 JSON columns are no longer silently ignored, but included in properties. But indeed the value is rendered as a string, which for outputFormat=application/json implies quoting (and escaping of existing quotes). So, one would get "RANGE": ​"{\"min\":\"37\",\"max\":\"93\"}", where other documentation seems to suggest that things like "RANGE": ​{"min":"37","max":"93"} should be possible. (But that's probably not based on a JSON column. Curious how that's created then though.) – Arjan Jul 27 '18 at 15:10
  • Another aside for future reference: indeed hstore is mapped to JSON, which is really nice for further processing. Unfortunately, by design PostgreSQL hstore only allows for text values and null. A quick test using 'min => 37, max => 93'::hstore as RANGE in a GeoServer view, yields "properties": {"range": {"max": "93", "min": "37"} } in the WFS output (using a lowercase key name). – Arjan Aug 18 '18 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.