Does pg_featureserv support JSONB fields?
I have a spatial table with a table id, geometry field, unique id field and a JSONB field for the rest of the data. Does pg_featureserv expand JSONB fields or would I have to create a View to do that?
As far as I know pg_featureserv doesn't expand JSONB.
Edit: my initial response was probably not directly helpful, as the question was about pg_tileserv rather than pg_featureserv.
MVT tiles
pg_tileserv constructs a SQL query that creates a tile using the ST_AsMVT comamnd in PostGIS. The PostGIS docs say:
The Mapbox Vector Tile format can store features with varying sets of attributes. To use this capability supply a JSONB column in the row data containing Json objects one level deep. The keys and values in the JSONB values will be encoded as feature attributes.
So with pg_tileserv, a JSONB field should be automatically expanded out to set multiple feature attributes.
GeoJSON
pg_featureserv uses the PostGIS function ST_AsGeoJSON, which acts differently: as JSON can represent nested data it doesn't do flattening. If you apply the function to data with a JSON column called data, the resulting features will have a property called data that has the same structure as the column (i.e., it will be an object). This is arguably more useful than automatically flattening data structures unnecessarily.
@jamesscottbrown So can I search JSONB fields or not using pg_featureserv?
@donnyv does this PR https://github.com/CrunchyData/pg_featureserv/pull/165 fix your issue?