Geoserver

ImageMosaic

Geoserver

Overview

An open source software server written in Java that allows users to share and edit geospatial data.

>> Presentation Slide: Geoserver <<

ImageMosaic

Introduction

The ImageMosaic plugin is provided by GeoTools, and allows the creation of a mosaic from a number of georeferenced rasters.

 

The plugin can be used with Geotiffs, as well as rasters accompanied by a world file (.pgw for png files, .jgw for jpg files, etc.)

*The GeoTIFF format embeds geospatial metadata into image files such as aerial photography, satellite imagery, and digitized maps so that they can be used in GIS applications.

Mosaic

The “Mosaic” operation creates a mosaic of two or more source images. This operation could be used for example to assemble a set of overlapping geospatially rectified images into a contiguous image.

 

It could also be used to create a montage of photographs such as a panorama.

Briefly...

the ImageMosaic plugin is responsible for composing together a set of similar raster data.

 

Each image of this set is commonly referred to as a granule..

Once a limitation, but now..

  • The granules do not need to share the same coordinate reference system
  • The granules can be in different color models, with an allowance of mixing gray, RGB, RGBA and indexed color granules

File Creation

ImageMosaic

Index file

When a new store is created, an index Shapefile is generated.

 

The Shapefile will associate each granule file with its bounding box.

 

By default, a shapefile is used for the index, but PostGIS, H2, and Oracle are also supported, with additional configuration steps.

Configuration file

Within each store there are multiple configuration files that determine how the mosaic is rendered.

 

This file is the primary file used to store the parameters that control the ImageMosaic plugin.

 

When created by Geoserver, it is by default called <directory>.properties, where <directory> is the name of the root directory of the store.

Levels=0.4,0.4
Heterogeneous=false
AbsolutePath=false
Name=osm
TypeName=osm
Caching=false
ExpandToRGB=false
LocationAttribute=location
SuggestedSPI=it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReaderSpi
SuggestedFormat=org.geotools.gce.geotiff.GeoTiffFormat
CheckAuxiliaryMetadata=false
LevelsNum=1

Sample of a configuration file

*This file usually does not require manual editing.

Configuration file

By default the ImageMosaic index is specified by a shapefile, which is located at the root of the ImageMosaic directory, just like the primary configuration file.

 

If different storage is needed for the index, it can be specified by using a datastore.properties file placed at the root of the ImageMosaic directory.

SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
host=localhost
port=5432
database=osm
schema=public
user=user
passwd=password
Loose\ bbox=true
Estimated\ extends=false
validate\ connections=true
Connection\ timeout=10
preparedStatements=true

Sample of datastore.properties for PostGIS index

*tested successfully for index: Oracle, PostgreSQL, H2, SQLServer.

datastore.properties

Configuration file

The schema for the index store may expose other custom attributes which can be used later for filtering the ImageMosaic granules on the fly during a WMS or WCS request or to diver WMS and WCS dimensions like TIME, ELEVATION and so on.

 

This is configured by the indexer.properties file.

Schema=*the_geom:Polygon,location:String,ingestion:java.util.Date,elevation:Double
PropertyCollectors=TimestampFileNameExtractorSPI[timeregex](ingestion),DoubleFileNameExtractorSPI[elevationregex](elevation)
TimeAttribute=ingestion
ElevationAttribute=elevation
Caching=false
AbsolutePath=false

Sample of indexer.properties

indexer.properties

Store & Coverage Parameters

ImageMosaic

Store Parameters

By default, ImageMosaic will be an option in the Raster Data Sources list when creating a new data store.

Option Description
Workspace Workspace for the store
Data Source Name Name of the store
Description Description of the store
Enabled Determines whether the store is enabled. If unchecked, all layers in the store will be disabled.
URL The location of the store. Can be a local directory.

Coverage Parameters

Creation of the store is the first step to getting an ImageMosaic published in GeoServer. Most of the configuration is done when publishing the resulting coverage (layer).

 

The Coverage Editor gives users the possibility to set a few control parameters to further control the mosaic creation process.

Using the ImageMosaic

ImageMosaic

Create a new store

1. Go to Data PanelStores and click Add new Store.

2. Select ImageMosaic under Raster Data Source:

 

3. Fill in the Store Parameters.

4. Click Save.

Create a new coverage (layer)

1. Navigate to Data PanelLayers and click Add a new resource.

2. Choose the name of the store you just created.

3. Click the layer you wish to configure and you will be presented with the Coverage Editor.

4. Click Save.

5. Use the Layer Preview to view the mosaic.

Configuration Examples

ImageMosaic

DEM/Bathymetry

Such a mosaic can be used to serve large amounts of data representing altitude or depth and therefore does not specify colors directly (it needs an SLD to generate pictures).

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
  xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld      http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>gtopo</Name>
    <UserStyle>
      <Name>dem</Name>
      <Title>Simple DEM style</Title>
      <Abstract>Classic elevation color progression</Abstract>
      <FeatureTypeStyle>
        <Rule>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <ColorMap>
              <ColorMapEntry color="#000000" quantity="-9999" label="nodata" opacity="1.0" />
              <ColorMapEntry color="#AAFFAA" quantity="0" label="values" />
              <ColorMapEntry color="#00FF00" quantity="1000" label="values" />
              <ColorMapEntry color="#FFFF00" quantity="1200" label="values" />
              <ColorMapEntry color="#FF7F00" quantity="1400" label="values" />
              <ColorMapEntry color="#BF7F3F" quantity="1600" label="values" />
              <ColorMapEntry color="#000000" quantity="2000" label="values" />
            </ColorMap>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Aerial Imagery

A mosaic that will serve aerial imagery, specifically RGB GeoTIFFs. Because this is visual data, in the Coverage Editor you can use the basic raster style, which is just a stub SLD to instruct the GeoServer raster renderer to not do anything particular in terms of color management

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
  xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld      http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>raster</Name>
    <UserStyle>
      <Name>raster</Name>
      <Title>Raster</Title>
      <Abstract>A sample style for rasters, good for displaying imagery       </Abstract>
      <FeatureTypeStyle>
        <FeatureTypeName>Feature</FeatureTypeName>
        <Rule>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Scanned Maps

Serve scanned maps (mostly B&W images) via a GeoServer mosaic.

In the Coverage Editor you can use the basic raster since there is no need to use any of the advanced RasterSymbolizer capabilities.

Dynamic Imagery

A mosaic need not be static. It can contain granules which change, are added or deleted.

Etc..

Thank You

Geoserver - ImageMosaic

By Annuar Faiz

Geoserver - ImageMosaic

  • 126