2

I'm currently working with raster data and serving it to a web application using Geoserver. I want to be able to perform queries to retrieve the raster data from a PostgreSQL database with the PostGIS extension to a web application. One of the solutions was to use the ImageMosaicJDBC plugin but I haven't been able query or filter the raster data stored in the PostGIS database from either the WMS or WCS services in Geoserver.

I want to know is there is a standard way to perform queries or filters on raster data based on WMS or WCS requests through a front end such as OpenLayers. Do I use the ImageMosaic plugin instead of the ImageMosaicJDBC? Is WCS more appropriate for these purposes?

3
  • cql_filter might help.
    – pLumo
    Jul 17, 2018 at 14:52
  • I'm not sure if cql_filter will work with raster data behind a WMS, I always thought of it as querying vector data that are portrayed using WMS, I suppose it depends on what sort of querying you want to do. WCS by itself is not intended to be queried, rather data is described and operations exist for you to manipulate the data and download it. The standard for querying coverage data for WCS is WCPS, but AFAIK it is not supported by GeoServer ~ you could switch to using rasdaman which can work with PostgreSQL
    – nmtoken
    Jul 18, 2018 at 14:07
  • 1
    The cql_filter does not work for raster data imported using the standard raster2pgsql because there are no attributes attached using my NetCDF files. Jul 18, 2018 at 17:48

1 Answer 1

5

The solution I arrived at was to use the ImageMosaic plugin versus the ImageMosaicJDBC plugin. The setup was simple and it allowed querying based on a number of parameters that I could setup in PostgreSQL / PostGIS. Other reasons include:

  • ImageMosaic allows for more intuitive queries and less database overhead. The ImageMosaicJDBC plugin requires a pyramid structure which is not intuitive.
  • The raster files are stored in their raw, original format if they're supported by the ImageMosaic plugin. ImageMosaicJDBC required a converted raster to an intermediary format in the database.
  • No additional setup required both from Geoserver, since the ImageMosaic plugin is included, and by the DBMS (in my case, PostgreSQL / PostGIS) because ImageMosaic automatically creates the requires data structures.
  • Increases performance because Geoserver pulls the raster data from its own directory instead of querying and downloading the raster data from the database.

Please note that it was required for me to set preparedStatements to false in my indexer.properties file to allow cql_filter to work


Although there are other guides out there, I used the ones provided by Geoserver,

Here are additional references that helped me with this solution,

2
  • You can accept your own answer :)
    – nmtoken
    Jul 25, 2018 at 17:32
  • I recently did! After more research that answer remains true Jul 26, 2018 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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