4

If I have an ImageMosaic in GeoServer containing several raster images that overlap, is there a way to retrieve/display one of the original images? Could I use CQL or WCS to get them by fileName or ID or some other attribute?

Do I need to worry about the Image Mosaic JDBC plugin or can I do what I want using just the default ImageMosaic plugin?

Can someone point me to the closest documentation or tutorial online to get me started?

2 Answers 2

5

The image index typically has attributes that you collected via property collectors (if you configured them). This allows you to select a single image, using the CQL_FILTER parameter: set a filter that acts against the attributes of the mosaic index, and it select the one image you want.

If you don't have any other attribute, you can try using the "location" one and matching the file name, maybe with a like filter, e..g: location LIKE '%myFile.tif'

If your use case is to always select at most one image, you can also set the maximum number of returned granules to 1, check the parameters in the layer configuration (quite useful if you have millions of images in your mosaic, you really don't want ot mosaic them all by default).

1
  • Interesting. So I just used the GeoServer admin console to create an Image Mosaic pointing it to a folder with 2 images (wsiearth.tif and sampleImage.tif). Then I can add the following to display only my wsiearth image: &CQL_FILTER=location LIKE 'wsiearth.tif'
    – A. Mort
    May 31, 2020 at 17:23
0

The general idea of an image mosaic is to display all of the images in it. The only control that you have is over the "order" they are displayed using the SORTING parameter to control which image is on top.

You can filter the mosaic by TIME or ELEVATION parameters or a custom DIMENSION as described in the manual. But there is no specific way to limit that to just one image.

1
  • As @Andrea Aime points out you can limit the number of granules that is returned. However if you use a filter expression or a dimension that would return several hits you would only get one granule, and you have no control of which you are getting. On the other hand, if you filter on location with an exact match you would of course only get that one granule.
    – Stefan
    Nov 11, 2020 at 9:06

Your Answer

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

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