Monday, July 09, 2012

Geoserver ImageMosaic plugin mini troubleshooter

Geoserver Image Mosaic Plugin troubleshooting.

During a recent project, I was challenged to load thousands of images using Geoserver, which is not perfectly suited to this task, due to the high footprint incurred in creating multiple layers and the loading of images and Geoserver itself.

To overcome the situation, the ImageMosaicPlugin offers a nice option to load a folder with images as a single layer where every image should have the following characteristics:

the image
E13B33B.jpg (or TIF or PNG or ...)
the world file
E13B33B.jgw (of TFW or PNW or ...)
and the most important, the projection file
E13B33B.prj

The image file explains by itself, is the raster you want to display.

The world file is a small text file including the size of the pixel in both horizontal and vertical direction, expresed with the first and fourth line. That size is expressed on the same units as the image, which in my case is on decimal degrees.
The last two lines correspond to the center position of pixel in the up left corner


0.00002777777775
0.0
0.0
-2.77777777777778E-05
-104.222208333111
19.4999861110111

And Finally, the PRJ file is the definition of the projection, which I extracted using GDALINFO


GEOGCS["WGS 84", 
  DATUM["World Geodetic System 1984", 
    SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], 
    AUTHORITY["EPSG","6326"]], 
  PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
  UNIT["degree", 0.017453292519943295], 
  AXIS["Geodetic longitude", EAST],
  AXIS["Geodetic latitude", NORTH],  
  AUTHORITY["EPSG","4326"]]




Is important to add this last file because otherwise you will receive the following error:


Could not list layers for this store, an error occurred retrieving them: Unable to acquire a reader for this coverage with format: ImageMosaic


So be sure to have them all.

Now that you have all the files in a folder fulfilling this characteristics and requirements, is possible now to use the ImageMosaicPlugin to load that folder, which will automatically create a shapefile containing the spatial index if the images, and which can be further queried using CQL, which i hope I will explain later.

Hope this helps.

Cheers.
UB

UPDATE:


In case u forgot some of the previous steps. the Plugin will create a shapefile named after the directory, so be sure to delete all created files with .shp and alikes, otherwise  it will fail to create the desired layer.




No comments: