sing the image mosaic plugin
TRANSCRIPT
-
8/3/2019 Sing the Image Mosaic Plugin
1/21
-
8/3/2019 Sing the Image Mosaic Plugin
2/21
To be more specific, if we cant assume that all the granules share the same spatial layout
and overviews set we would not be able to asses the raster dimensions (width and height)
the spatial dimensions (grid-to-world and envelope) and the overviews set to the finalmosaic coverage, unless we specify them somehow or we default to something. As long
as we can assume that the various granules share the same spatial elements as well as the
same overviews set we can inherit the first definition for the final mosaic. This limitationcan be overcome with more work.
Granule Index
In order to configure a new CoverageStore and a new Coverage with this plugin, an index
file needs to be generated first in order to associate each granule to its bounding box.Currently we support only a Shapefile as a proper index, although it would be possible to
extend this and use other means to persist the index.
More specifically, the following files are needed:
1. A shapefile that contains enclosing polygons for each raster file. This shapefileneeds to have a field whose values are the paths for the mosaic granules. The path
can be either relative to the shapefile itself or absolute, moreover, while the
default name for the shapefile attribute that contains the granules paths is
location, such a name can be configured to be different (well describe this lateron).
2. A projection file (.prj) for the above-mentioned shapefile.
3. A configuration file (.properties). This file contains properties such as cell size inx and y direction, the number of rasters for the ImageMosaic coverage, etc.. We
will describe this file in the next section.
Later on we will describe the process of creating an index for a set of granules.
Configuration File
The mosaic configuration file is used to store some configuration parameters to controlthe ImageMosaic plugin. It is created as part of the mosac creation and usually do not
require manual editing. The table below describes the various elements in this
configuration file.
Parameter Mandatory Description
Envelope2D Y
Contains the envelope for this mosaic formatted as
LLCx,LLXy URCx,URCy (notice the space between the
coordinates of the Lower Left Corner and the coordinates
of the Upper Right Corner). An example isEnvelope2D=432500.25,81999.75 439250.25,84999.75
LevelsNum Y Represents the number of reduced resolution layers that we
2
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#granule-indexhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#granule-indexhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-file -
8/3/2019 Sing the Image Mosaic Plugin
3/21
currently have for the granules of this mosaic.
Levels Y
Represents the resolutions for the various levels of the
granules of this mosaic. Please remember that we are
currently assuming that the number of levels and theresolutions for such levels are the same across alll the
granules.
Name Y Represents the name for this mosaic.
ExpandToRGB N
Applies to colormapped granules. Asks the internal mosaicengine to expand the colormapped granules to RGB prior
to mosaicing them. This is needed whenever the the
granulesdo not share the same color map hence a straight
composition that would retain such a color map cannot beperformed.
AbsolutePath Y
It controls whether or not the path stored inside the
location attribute represents an absolute path or a path
relative to the location of the shapefile index. Notice that arelative index ensure much more portability of the mosaic
itself. Default value for this parameter is False, which
means relative paths.
LocationAttribute NThe name of the attribute path in the shapefile index.Default value is location.
Creating Granules Index and Configuration File
The refactored version of the ImageMosaic plugin can be used to create the shapefile
index as well as the mosaic configuration file on the fly without having to rely on gdal orsome other similar utility.
If you have a tree of directories containing the granules you want to be able to serve as a
mosaic (and providing that you are respecting the conditions written above) all you need
to do is to point the GeoServer to such a directory and it will create the proper ancillary
files by inspecting all the files present in the the tree of directories starting from theprovided input one.
Configuring a Coverage in Geoserver
This is a process very similar to creating a FeatureType. More specifically, one has toperform the steps higlighted in the sections here below.
Create a new CoverageStore:
3
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#creating-granules-index-and-configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuring-a-coverage-in-geoserverhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#creating-granules-index-and-configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuring-a-coverage-in-geoserverhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coveragestore -
8/3/2019 Sing the Image Mosaic Plugin
4/21
1. Go to Data Panel | Stores via the web interface and click Add new Store.
Finally click ImageMosaic - Image mosaicking plugin from Raster Data
Source:
ImageMosaic in the list of raster data stores
2. In order to create a new mosaic is necessary:
To chose the Workspace in the Basic Store Info section.
To give a name in the Basic Store Info section.
To fill the field URL in the Connection Parameters section. You have three
alternatives:
o Inserting the absolute path of the shapefile.o Inserting the absolute path of the directory in which the mosaic shapefile
index resides, the GeoServer will look for it and make use of it.o Inserting the absolute path of a directory where the files you want to
mosaic together reside. In this case GeoServer automatically creates the
needed mosaic files (.dbf, .prj, .properties, .shp and .shx) by inspecting the
data of present in the given directory (GeoServer will also find the data inthe subdirectories).
Finally click the Save button:
4
-
8/3/2019 Sing the Image Mosaic Plugin
5/21
Configuring an ImageMosaic data store
Create a new Coverage using the new ImageMosaic CoverageStore:
1. Go to Data Panel | Layers via the web interface and click Add a new resource.Finally choose the name of the Store you just created:
5
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coverage-using-the-new-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coverage-using-the-new-imagemosaic-coveragestore -
8/3/2019 Sing the Image Mosaic Plugin
6/21
Layer Chooser
2. Click on the layer you wish to configure and you will be presented with the
Coverage Editor:
6
-
8/3/2019 Sing the Image Mosaic Plugin
7/21
7
-
8/3/2019 Sing the Image Mosaic Plugin
8/21
Coverage Editor
3. Make sure there is a value for Native SRS, then click the Submit button. If the
Native CRS is UNKNOWN, you must to declare the SRS specifying him inthe Declared SRS field. Hopefully there are no errors.
4. Click on the Save button.
Once you complete the preceding operations it is possible to access the OpenLayers map
preview of the created mosaic.
Warning
In case the created layer appears to be all black it might be that GeoServer has not found
no acceptable granules in the provided ImageMosaic index. It is possible that the
shapefile index empty (not granules where found in in the provided directory) or it might
be that the granules paths in the shapefile index are not correct as it might happen in case
we have moved an existing index using absolute paths to another place. If the shapefileindex paths are not correct the dbf file can be opened and fixed with, as an instance
OpenOffice. As an alternative on could simple delete the index and let GeoServerrecreate it from the root directory.
Tweaking an ImageMosaic CoverageStore:
The Coverage Editor gives users the possibility to set a few control parameters to further
tweak and/or control the mosaic creation process. Such parameters are as follows:
Parameter Description
MaxAllowedTiles
Set the maximum number of the tiles that can be loadsimulatenously for a request. In case of a large mosaic this
parameter should be opportunely set to not saturating the serverwith too many granules loaded at the same time.
BackgroundValuesSet the value of the mosaic background. Depending on the
nature of the mosaic it is wise to set a value for the no data area
(usually -9999). This value is repeated on all the mosaic bands.
OutputTransparentColorSet the transparent color for the created mosaic. See below for an
example:
8
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#tweaking-an-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#tweaking-an-imagemosaic-coveragestore -
8/3/2019 Sing the Image Mosaic Plugin
9/21
OutputTransparentColor parameter configured with no color
9
-
8/3/2019 Sing the Image Mosaic Plugin
10/21
OutputTransparentColor parameter configured with no data color
InputTransparentColor
Set the transparent color for the granules prior to mosaicing them
in order to control the superimposition process between them.When GeoServer composes the granules to satisfy the user
request, some of them can overlap some others, therefore, setting
this parameter with the opportune color avoids the overlap of no
data areas between granules. See below for an example:
10
-
8/3/2019 Sing the Image Mosaic Plugin
11/21
InputTransparentColor parameter not configured
InputTransparentColor parameter configured
AllowMultithreadingIf true enable tiles multithreading loading. This allows to
perform parallelized loading of the granules that compose themosaic.
USE_JAI_IMAGEREAD
Controls the low level mechanism to read the granules. Iftrue GeoServer will make use of JAI ImageRead operation
and its deferred loading mechanism, if false GeoServer willperform direct ImageIO read calls which will result in
immediate loading.
SUGGESTED_TILE_SIZE:Controls the tile size of the input granules as well as the tile
size of the output mosaic. It consists of two positiveintegersseparated by a comma,like 512,512.
11
-
8/3/2019 Sing the Image Mosaic Plugin
12/21
Note
Deferred loading consumes less memory since it uses a streaming approach to load in
memory only the data that is needed for the processing at each time, but, on the otherside, may cause problems under heavy load since it keeps granules files open for a long
time to support deferred loading.
Note
Immediate loading consumes more memory since it loads in memory the whole requested
mosaic at once, but, on the other side, it usually performs faster and does not leave roomfor too many files open error conditions as it happens for deferred loading.
Configuration examples
Now we are going to provide a few examples of mosaic configurations to demonstrate
how we can make use of the ImageMosaic parameters.
DEM/Bathymetric mosaic configuration (raw data)
Such a mosaic can be use to serve large amount of data which represents altitude or depthand therefore does not specify colors directly while it reather needs an SLD to generate
pictures. In our case we have a DEM dataset which consists of a set of raw geotiff files.
The first operation is to create the CoverageStore following the three steps showed in
Create a new CoverageStore specifying, for example, the path of the shapefile in theURL field. Inside the Coverage Editor, Publishing tab - Default Title section, you can
specify the dem default style (Default Style combo box) in order to represent thevisualization style of the mosaic. The following is an example style:
gtopo
dem
Simple DEM style
Classic elevation color progression
1.0
12
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-exampleshttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#dem-bathymetric-mosaic-configuration-raw-datahttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-exampleshttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#dem-bathymetric-mosaic-configuration-raw-data -
8/3/2019 Sing the Image Mosaic Plugin
13/21
In this way you have a clear distinction between the different intervals of the dataset that
compose the mosaic, like the background and the no data area.
13
-
8/3/2019 Sing the Image Mosaic Plugin
14/21
14
-
8/3/2019 Sing the Image Mosaic Plugin
15/21
Note
The no data on the sample mosaic is -9999, on the other side the default background
value is for mosaics is 0.0.
The result is the following.
Basic configuration
By setting in opportune ways the other configuration parameters, it is possible to improveat the same time both the appearance of the mosaic as well as the its performances. As an
instance we could:
1. Make the no data areas transparent and coherent with the real data. To achieve
this we need to change the opacity of the no data ColorMapEntry in the dem
15
-
8/3/2019 Sing the Image Mosaic Plugin
16/21
style to 0.0 and set BackgroundValues parameter at -9999 so that empty
areas will be filled with this value. The result is as follows:
Advanced configuration
2. Allow multithreaded granules loading. By setting the AllowMultiThreading
parameter to tru GeoServer will load the granules in parallell sing multiple threadswith a consequent increase of the performances on some architectures..
The configuration parameters are the followings:
1. MaxAllowedTiles: 2147483647
2. BackgroundValues: -9999.
3. OutputTransparentColor: no color.4. InputImageThresholdValue: NaN.
5. InputTransparentColor: no color.
6. AllowMultiThreading: true.
7. USE_JAI_IMAGEREAD: true.8. SUGGESTED_TILE_SIZE: 512,512.
Aerial Imagery mosaic configuration
In this example we are going to create a mosaic that will serve aerial imagery, RGB
geotiffs in this case. Noticed that since we are talking about visual data, in the Coverage
Editor you can use the basic raster style, as reported here below, which is just a stub
16
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#aerial-imagery-mosaic-configurationhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#aerial-imagery-mosaic-configuration -
8/3/2019 Sing the Image Mosaic Plugin
17/21
SLD to instruct the GeoServer raster renderer to not do anything particular in terms of
color management:
raster
raster
Raster
A sample style for rasters, good for displaying imagery
Feature
1.0
The result is the following.
17
-
8/3/2019 Sing the Image Mosaic Plugin
18/21
Basic configuration
Note
Those ugly black areas, are the resulting of applying the eafalt mosaic parameters to a
mosaic that does not entirey cover its bounding box. The areas within the BBOX that arenot covered with data will default to a value of 0 on each band. Since this mosaic is RGB
wecan simply set the OutputTransparentCOlor to 0,0,0 in order to get back transparent
fills for the BBOX.
The various parameters can be set as follows:
1. MaxAllowedTiles: 2147483647
2. BackgroundValues: default value.
3. OutputTransparentColor: #000000 (to make transparent the background).4. InputImageThresholdValue: NaN.
5. InputTransparentColor: no color.6. AllowMultiThreading: true (in this way GeoServer manages the loading of thetiles in parallel mode with a consequent increase of the performances).
7. USE_JAI_IMAGEREAD: true.
8. SUGGESTED_TILE_SIZE: 512,512.
The results is the following:
18
-
8/3/2019 Sing the Image Mosaic Plugin
19/21
Advanced configuration
Scanned Maps mosaic configuration
In this case we want to show how to serve scanned maps (mostly B&W images) via a
GeoServer mosaic.
In the Coverage Editor you can use the basic raster style as shown above since there isnot need to use any of the advanced RasterSymbolizer capabilities.
The result is the following.
19
http://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#scanned-maps-mosaic-configurationhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#scanned-maps-mosaic-configuration -
8/3/2019 Sing the Image Mosaic Plugin
20/21
Basic configuration
This mosaic, formed by two single granules, shows a typical case where the no data
collar areas of the granules overlap, as it is shown in the picture above. In this case we
can use the InputTrasparentColor parameter at to make the collar areas disappear duringthe superimposition process, as instance, in this case, by using the #FFFFFF
InputTrasparentColor.
This is the result:
Advanced configuration
The final configuration parameters are the followings:
1. MaxAllowedTiles: 21474836472. BackgroundValues: default value.
3. OutputTransparentColor: no color.
20
-
8/3/2019 Sing the Image Mosaic Plugin
21/21
4. InputImageThresholdValue: NaN.
5. InputTransparentColor: #FFFFFF.
6. AllowMultiThreading: true (in this way GeoServer manages the loading of thetiles in parallel mode with a consequent increase of the performances).
7. USE_JAI_IMAGEREAD: true.
8. SUGGESTED_TILE_SIZE: 512,512.
Previous: CQL and ECQL
Next: Building and using an image pyramid
Table Of Contents
Using the ImageMosaic plugino Introduction
o Granule Index
o Configuration File
o Creating Granules Index and Configuration Fileo Configuring a Coverage in Geoserver
Create a new CoverageStore:
Create a new Coverage using the new ImageMosaic
CoverageStore: Tweaking an ImageMosaic CoverageStore:
o Configuration examples
DEM/Bathymetric mosaic configuration (raw data) Aerial Imagery mosaic configuration
Scanned Maps mosaic configuration
Continue Reading
Previous: CQL and ECQL
Next: Building and using an image pyramid
This Page
Show Source
http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/imagepyramid/imagepyramid.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#introductionhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#granule-indexhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#creating-granules-index-and-configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuring-a-coverage-in-geoserverhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coverage-using-the-new-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coverage-using-the-new-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#tweaking-an-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-exampleshttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#dem-bathymetric-mosaic-configuration-raw-datahttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#aerial-imagery-mosaic-configurationhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#scanned-maps-mosaic-configurationhttp://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/imagepyramid/imagepyramid.htmlhttp://docs.geoserver.org/latest/en/user/_sources/tutorials/image_mosaic_plugin/imagemosaic.txthttp://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/imagepyramid/imagepyramid.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#introductionhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#granule-indexhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#creating-granules-index-and-configuration-filehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuring-a-coverage-in-geoserverhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coverage-using-the-new-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#create-a-new-coverage-using-the-new-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#tweaking-an-imagemosaic-coveragestorehttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#configuration-exampleshttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#dem-bathymetric-mosaic-configuration-raw-datahttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#aerial-imagery-mosaic-configurationhttp://docs.geoserver.org/latest/en/user/tutorials/image_mosaic_plugin/imagemosaic.html#scanned-maps-mosaic-configurationhttp://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.htmlhttp://docs.geoserver.org/latest/en/user/tutorials/imagepyramid/imagepyramid.htmlhttp://docs.geoserver.org/latest/en/user/_sources/tutorials/image_mosaic_plugin/imagemosaic.txt