orbetello
Not logged in

Back to RasterLite2 Tutorials index



Tutorial: building and testing the Orbetello sample

In this tutorial we'll use a more exotic raster datasource, i.e. an orthorectified scene taken from the OrbView3 satellite. It differs from the previous Trieste sample because in this case we still have 16 bit channels, but this one is multi-spectral aka multi-band image; 4 different spectral bands are actually contained in this raster, respectively corresponding to Blue, Green, Red and Near Infrared.
Such a configuration doesn't match the usual RGB model, so isn't one ordinarily supported by many non-specialized, general purpose image viewers/editors.

Step 1) downloading the OrbView3 scene

Step 2) retrieve all basic informations about the OrbView3 scene

$ tiffinfo 3v050307m0000654221a520004300502m_001665044_1GST.TIF
TIFF Directory at offset 0x8c483f7 (147096567)
  Subfile Type: (0 = 0x0)
  Image Width: 2218 Image Length: 8275
  Resolution: 1, 1
  Bits/Sample: 16
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: RGB color
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 4
  Rows/Strip: 1
  Planar Configuration: separate image planes
  Tag 33550: 4.060000,4.060000,0.000000
  Tag 33922: 0.000000,0.000000,0.000000,676660.573232,4730184.769926,0.000000
  Tag 34735: 1,1,0,5,1024,0,1,1,1025,0,1,1,2052,0,1,9001,2054,0,1,9102,3072,0,1,
32632
  Tag 34737: WGS-84
$
As reported by the tiffinfo tool, this TIFF file contains a 2,218 x 8,275 raster; the suggested photometric interpretation is RGB (a some way misleading indication), and pixel values are of the UINT16 type (Sample Format: unsigned integer and Bits/Sample: 16).
Anyway there are 4 distinct bands (Samples/Pixel: 4), and the Planar Configuration is of the rather rare separate image planes type.
$ listgeo 3v050307m0000654221a520004300502m_001665044_1GST.TIF
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      ModelTiepointTag (2,3):
         0                 0                 0
         676660.573231925  4730184.7699264   0
      ModelPixelScaleTag (1,3):
         4.06              4.06              0
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GeogLinearUnitsGeoKey (Short,1): Linear_Meter
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_32N
      End_Of_Keys.
   End_Of_Geotiff.

PCS = 32632 (WGS 84 / UTM zone 32N)
Projection = 16032 (UTM zone 32N)
Projection Method: CT_TransverseMercator
   ProjNatOriginLatGeoKey: 0.000000 (  0d 0' 0.00"N)
   ProjNatOriginLongGeoKey: 9.000000 (  9d 0' 0.00"E)
   ProjScaleAtNatOriginGeoKey: 0.999600
   ProjFalseEastingGeoKey: 500000.000000 m
   ProjFalseNorthingGeoKey: 0.000000 m
GCS: 4326/WGS 84
Datum: 6326/World Geodetic System 1984
Ellipsoid: 7030/WGS 84 (6378137.00,6356752.31)
Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
Projection Linear Units: 9001/metre (1.000000m)

Corner Coordinates:
Upper Left    (  676660.573, 4730184.770)  ( 11d 9'25.27"E, 42d42'13.87"N)
Lower Left    (  676660.573, 4696588.270)  ( 11d 8'47.86"E, 42d24' 5.41"N)
Upper Right   (  685665.653, 4730184.770)  ( 11d16' 0.80"E, 42d42' 6.23"N)
Lower Right   (  685665.653, 4696588.270)  ( 11d15'21.49"E, 42d23'57.85"N)
Center        (  681163.113, 4713386.520)  ( 11d12'23.79"E, 42d33' 5.89"N)
$
The listgeo tool confirms that this actually is GeoTIFF including full-referencing and that the intended Reference System is SRID=32632 (WGS 84 / UTM zone 32N); the declared pixel resolution equals to 4.06 meters on both axes (square pixels).

Step 3) creating the Orbetello Coverage

$ rl2tool CREATE -db orbetello.sqlite -cov orbetello -smp UINT16 \
-pxl MULTIBAND -bds 4 -cpr LZMA -srid 32632 -res 4.06

rl2_tool: request is CREATE
===========================================================
              DB path: orbetello.sqlite
             Coverage: orbetello
          Sample Type: UINT16
           Pixel Type: MULTIBAND
      Number of Bands: 4
          Compression: LZMA (7-zip, lossless)
   Tile size (pixels): 512 x 512
                 Srid: 32632
Pixel base resolution: X=4.059999999999999 Y=4.059999999999999
===========================================================

     SQLite version: 3.8.4.2
 SpatiaLite version: 4.2.0-devel
RasterLite2 version: 0.8

Raster Coverage "orbetello" successfully created

Operation CREATE successfully completed
$

Step 4) populating the Orbetello Coverage

$ rl2tool IMPORT -db orbetello.sqlite -cov orbetello \
-src 3v050307m0000654221a520004300502m_001665044_1GST.TIF -pyr

rl2_tool; request is IMPORT
===========================================================
              DB path: orbetello.sqlite
    Input Source path: 3v050307m0000654221a520004300502m_001665044_1GST.TIF
             Coverage: orbetello
              Section: from file name
Immediately building Pyramid Levels
===========================================================

     SQLite version: 3.8.4.2
 SpatiaLite version: 4.2.0-devel
RasterLite2 version: 0.8

Importing: 3v050307m0000654221a520004300502m_001665044_1GST.TIF
------------------
    Image Size (pixels): 2218 x 8275
                   SRID: 32632
       LowerLeft Corner: X=676660.57 Y=4696588.27
      UpperRight Corner: X=685665.65 Y=4730184.77
       Pixel resolution: X=4.05999999999998 Y=4.059999999999999
  ----------
    Pyramid levels successfully built for: 3v050307m0000654221a520004300502m_001665044_1GST

Operation IMPORT successfully completed
$
You'll simply invoke rl2tool IMPORT exactly in the same way already adopted in any other previous tutorial.

Step 5) creating and loading your own custom Raster Styles

5.1) downloading the Orbetello styles

Just download the appropriate resource-pack from here; it contains any SLD/SE RasterSymbolizer required by this tutorial.

5.2) exploring the SLD/SE RasterSymbolizer anatomy - take 2

You've already encountered RasterSymbolizers in the previous Trieste tutorial, and you are supposed to master at least a very basic comprehension about ContrastEnhancement options. We'll now examine yet another interesting feature supporter by RasterSymbolizers, i.e. ChannelSelection.
	<ChannelSelection>
		<RedChannel>
			<SourceChannelName>3</SourceChannelName>
		</RedChannel>
		<GreenChannel>
			<SourceChannelName>2</SourceChannelName>
		</GreenChannel>
		<BlueChannel>
			<SourceChannelName>1</SourceChannelName>
		</BlueChannel>
	</ChannelSelection>
	<ContrastEnhancement>
		<Histogram/>
	</ContrastEnhancement>
For any multi-band Coverage you can freely select your own band composition, so to produce natural colors or even false colors images:
	<ChannelSelection>
		<RedChannel>
			<SourceChannelName>4</SourceChannelName>
		</RedChannel>
		<GreenChannel>
			<SourceChannelName>3</SourceChannelName>
		</GreenChannel>
		<BlueChannel>
			<SourceChannelName>2</SourceChannelName>
		</BlueChannel>
	</ChannelSelection>
	<ChannelSelection>
		<GrayChannel>
			<SourceChannelName>4</SourceChannelName>
		</GrayChannel>
	</ChannelSelection>

5.3) importing all RasterSymbolizers into the DB-file

$ sqlite3 orbetello.sqlite
SQLite version 3.8.4.2 2014-03-26 18:51:19
Enter ".help" for usage hints.
sqlite> .null NULL
sqlite> SELECT load_extension('mod_spatialite');
NULL
sqlite> SELECT CreateStylingTables();
1
sqlite> SELECT RegisterRasterStyledLayer('orbetello',
   ...> XB_Create(XB_LoadXML('./orbetello_styles/orbetello_rgb_normalize.xml'), 1, 1));
1
sqlite> SELECT RegisterRasterStyledLayer('orbetello',
   ...> XB_Create(XB_LoadXML('./orbetello_styles/orbetello_rgb_histogram.xml'), 1, 1));
1
sqlite> SELECT RegisterRasterStyledLayer('orbetello',
   ...> XB_Create(XB_LoadXML('./orbetello_styles/orbetello_rgb_gamma_2.5.xml'), 1, 1));
1
sqlite> SELECT RegisterRasterStyledLayer('orbetello',
   ...> XB_Create(XB_LoadXML('./orbetello_styles/orbetello_ir_normalize.xml'), 1, 1));
1
sqlite> SELECT RegisterRasterStyledLayer('orbetello',
   ...> XB_Create(XB_LoadXML('./orbetello_styles/orbetello_ir_gray_normalize.xml'), 1, 1));
1
sqlite> .quit
$
This step exactly corresponds to the task already explained in the Trieste tutorial.

Step 6) testing the Orbetello sample (and playing with Styles)

As you've already done in any previous tutorial you can now directly test the Orbetello Coverage by publishing a standard WMS service.
You simply have to start the wmslite light-weight server, then connecting some WMS viewer (e.g. LibreWMS) to the service being published on localhost aka IP address 127.0.0.1, port 8080.

albegna default
This first example corresponds to the default Style (no RasterSymbolizer at all): and in this case too, as we were expecting, it's a very unattractive image.
Please note: for any MULTIBAND Coverage the default style implicitly applied by RasterLite2 simply consist in selecting just the first band and then apply a basic, non-optimized Grayscale rendering.

albegna RGB gamma 2.5
This second example represents a natural colors image (Red, Green, Blue); Contrast Enhancement corresponds to GammaValue by applying a 2.5 factor.
And in this case too we'll get a bright but very poorly contrasted image.

albegna RGB histogram
This third example represents a natural colors image (Red, Green, Blue); Contrast Enhancement corresponds to Histogram.
As we've already noticed in the Trieste case, this Contrast Enhancement method produces fairly good results, but not completely convincing.

albegna RGB normalize
This fourth example represents a natural colors image (Red, Green, Blue); Contrast Enhancement corresponds to Normalize.
And even in the case of RGB images this Contrast Enhancement method confirms to be the best available option, because it usually produces naturally-looking images presenting a well balanced overall contrast.

albegna IR-false-colors normalize
This fifth example represents a false colors image (Near Infrared, Red, Green); Contrast Enhancement corresponds to Normalize.
Please note: this image surely looks strongly unnatural and rather alien; anyway you could easily notice that it substantially facilitates photointerpretation, because all the vegetation is now clearly identified by many different shades or red.

albegna IR-gray normalize
And finally this last examples shows a Grayscale image corresponding to the Near Infrared band alone and supporting the Normalize Contrast Enhancement method.



Back to RasterLite2 Tutorials index