I have a postgis table with many different rasters in it. Is it possible for geoserver to grab only one of the rasters from the table based on something like a where clause?

  • You can try to build a view. docs.geoserver.org/2.7.0/user/data/database/sqlview.html – Master Bee Nov 12 '15 at 20:27
  • 1
    First, since I'm storing rasters in the postgis table, I'm using geoserver's Image Mosaic JDBC as per this link postgis raster. Second, when using Image Magic JDBC, the option to "Configure new SQL view..." isn't available. Instead I'm only presented with the link "Configure new Coverage view..." which is something completely different. – apricity Nov 12 '15 at 20:41
  • It should work simply by adding an attribute (for example YEAR) into your image mosaic table and then adding into GetMaps &CQL_FILTER=YEAR=2015 – user30184 Nov 13 '15 at 0:47
  • @user30184 When you say add a YEAR attribute to the "image mosaic table" do you mean there just needs to be a column called 'YEAR' in my raster table... ie rid, rast, YEAR or is there another place I need to specify YEAR so that geoserver knows about it? I have another table called mosaic that has columns name, tiletable, minx, miny, maxx, maxy, resx, resy - year doesn't need to be added to that table does it? – apricity Nov 13 '15 at 1:53
  • I have not done this myself, but the "mosaic" table is what I meant. If you add YEAR or any other attribute into that it should be possible to filter the "granules" with CQL_FILTER. In this question column named "UUID" was used with success osgeo-org.1560.x6.nabble.com/…. – user30184 Nov 13 '15 at 6:30

After checking the code quickly, I believe that the GeoTools ImageMosaic JDBC module has no filtering abilities whatsoever.

| improve this answer | |
  • In that case, If I have a raster per day of the year over many years what's the best way to serve them through geoserver? I could save each raster as a geotif file and then use this method However because I'm spanning years 1980-present that will create thousands of stores/layers which doesn't seem right. – apricity Nov 23 '15 at 19:02
  • As said in the other ticket, use the plain imagemosaic reader, that's fully dimension enabled. – Andrea Aime Nov 23 '15 at 21:06

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.