I'm trying to create image pyramid of multiple smaller images for GeoServer use. I have done this by first creating virtual dataset with gdalbuildvrt and then with gdal_retile.py.

The problem I'm having is, that the original images are disjoint, and thus the virtual dataset has a lot of empty space with no data (rendered as black). I would want to render this area transparent.

The images are all JPEgs with YCbCr colorspace thus they do not contain alpha channel, nor does the original data have nodata value set. Also the images contain all pixel values in 0-255 range (i.e. I cannot use -a_nodata of gdal_translate without getting holes in the picture). I have narrowed it down to two solutions: One would be to use external mask, but I'm wondering the performance impact of this solution. Not to mention the need to store an extra image that is almost completely empty. The second solution would be to edit every single pixel in the original images so that none would have value 0. then use 0 as nodata value.

Any ideas which method I should use? Or neither?

  • Depending on how large coverage you have it could be enough to create proper set of overviews for each image and then combine the images into a single layer with ImageMosaic docs.geoserver.org/latest/en/user/data/raster/imagemosaic/…. Result may be slow if users zoom far out but then you can show them some other scale dependent layer that you have prepared for example with something like gdal_translate -of GTiff -co tiled=yes -co compress=JPEG -size 2000 2000 input.vrt output_Small.tif – user30184 Nov 5 '19 at 8:39
  • @user30184 I originally used ImageMosaic, but users need images from all zoom levels, and the amount of images is so big that ImageMosaic performance wont cut it. – jfp Nov 5 '19 at 11:13
  • Then you may consider to have a try with a group layer. Then the image mosaic is used only at large scales and the number of images which need to be opened remains small, and areas with no data will be handled automatically. – user30184 Nov 5 '19 at 13:30
  • @user30184 This is something I haven't heard of. Do you have a link for some material or something that would explain how that would work and how to implement it? – jfp Nov 5 '19 at 14:33
  • Layer groups are documented in docs.geoserver.org/latest/en/user/data/webadmin/…. This gis.stackexchange.com/questions/27472/… and this docs.geoserver.org/stable/en/user/styling/sld/reference/… should help with making the group scale dependent. – user30184 Nov 5 '19 at 14:51

Your Answer

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

Browse other questions tagged or ask your own question.