Update of "planetEarth"
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 1e566279bcceb4e9e5e956589285a3144696b21a
Page Name:planetEarth
Date: 2014-04-03 16:27:26
Original User: sandro
Parent: 511cbbeabb8383170e6f21ef2f61640574c56685 (diff)
Next d19fb34bc28999323656ae39be1ea07abe1e8e57
Content

Back to RasterLite2 Tutorials index



Tutorial: building and testing the Planet Earth sample

In this first tutorial we'll use the following input datasources: please download all them right now. They are Open Data released under a free license, and are available absolutely for free.

Step 1.a) creating the TrueMarble Coverage

$ rl2tool CREATE -db earth.sqlite -cov TrueMarble -smp UINT8 \
-pxl RGB -cpr JPEG -srid 4326 -res 0.0166666666666667

rl2_tool: request is CREATE
===========================================================
              DB path: earth.sqlite
             Coverage: TrueMarble
          Sample Type: UINT8
           Pixel Type: RGB
      Number of Bands: 3
          Compression: JPEG (lossy)
  Compression Quality: 80
   Tile size (pixels): 512 x 512
                 Srid: 4326
Pixel base resolution: X=0.0166666666666667 Y=0.0166666666666667
===========================================================

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

Raster Coverage "TrueMarble" successfully created

Operation CREATE successfully completed
$

Step 1.b) populating the TrueMarble Coverage

$ rl2tool IMPORT -db earth.sqlite -cov TrueMarble \
-src TrueMarble.2km.21600x10800.tif -pyr

rl2_tool; request is IMPORT
===========================================================
              DB path: earth.sqlite
    Input Source path: TrueMarble.2km.21600x10800.tif
             Coverage: TrueMarble
              Section: from file name
Immediately building Pyramid Levels
===========================================================

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

Importing: TrueMarble.2km.21600x10800.tif
------------------
    Image Size (pixels): 21600 x 10800
                   SRID: 4326
       LowerLeft Corner: X=-180.00 Y=-90.00
      UpperRight Corner: X=180.00 Y=90.00
       Pixel resolution: X=0.01666666666666666 Y=0.01666666666666666
  ----------
    Pyramid levels successfully built for: TrueMarble.2km.21600x10800

Operation IMPORT successfully completed
$

Step 2.a) creating the NaturalEarth Coverage

$ rl2tool CREATE -db earth.sqlite -cov NaturalEarth -smp UINT8 \
-pxl RGB -cpr JPEG -srid 4326 -res 0.0166666666666667

rl2_tool: request is CREATE
===========================================================
              DB path: earth.sqlite
             Coverage: NaturalEarth
          Sample Type: UINT8
           Pixel Type: RGB
      Number of Bands: 3
          Compression: JPEG (lossy)
  Compression Quality: 80
   Tile size (pixels): 512 x 512
                 Srid: 4326
Pixel base resolution: X=0.0166666666666667 Y=0.0166666666666667
===========================================================

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

Raster Coverage "NaturalEarth" successfully created

Operation CREATE successfully completed
$
Not really different from step 1.a): we are simply creating yet another RasterLite2 Coverage within the same DB-file.

Step 2.b) populating the NaturalEarth Coverage

$ rl2tool IMPORT -db earth.sqlite -cov NaturalEarth \
-src NE1_HR_LC_SR_W_DR.tif -pyr

rl2_tool; request is IMPORT
===========================================================
              DB path: earth.sqlite
    Input Source path: NE1_HR_LC_SR_W_DR.tif
             Coverage: NaturalEarth
              Section: from file name
Immediately building Pyramid Levels
===========================================================

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

Importing: NE1_HR_LC_SR_W_DR.tif
------------------
    Image Size (pixels): 21600 x 10800
                   SRID: 4326
       LowerLeft Corner: X=-180.00 Y=-90.00
      UpperRight Corner: X=180.00 Y=90.00
       Pixel resolution: X=0.01666666666667 Y=0.01666666666667
  ----------
    Pyramid levels successfully built for: NE1_HR_LC_SR_W_DR

Operation IMPORT successfully completed
$
Exactly the same as in step 1.b)

Step 3.a) creating the Etopo1 Coverage

$ rl2tool CREATE -db earth.sqlite -cov Etopo1 -smp UINT8 \
-pxl RGB -cpr JPEG -srid 4326 -res 0.0166666666666667

rl2_tool: request is CREATE
===========================================================
              DB path: earth.sqlite
             Coverage: Etopo1
          Sample Type: UINT8
           Pixel Type: RGB
      Number of Bands: 3
          Compression: JPEG (lossy)
  Compression Quality: 80
   Tile size (pixels): 512 x 512
                 Srid: 4326
Pixel base resolution: X=0.0166666666666667 Y=0.0166666666666667
===========================================================

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

Raster Coverage "Etopo1" successfully created

Operation CREATE successfully completed
$
Same as in steps 1.a) and 2.a)

Step 3.b) populating the Etopo1 Coverage

$ rl2tool IMPORT -db earth.sqlite -cov Etopo1 \
-src color_etopo1_ice_full.tif -pyr

rl2_tool; request is IMPORT
===========================================================
              DB path: earth.sqlite
    Input Source path: color_etopo1_ice_full.tif
             Coverage: Etopo1
              Section: from file name
Immediately building Pyramid Levels
===========================================================

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

Importing: color_etopo1_ice_full.tif
------------------
    Image Size (pixels): 21600 x 10800
                   SRID: 4326
       LowerLeft Corner: X=-180.01 Y=-89.99
      UpperRight Corner: X=179.99 Y=90.01
       Pixel resolution: X=0.01666666666667 Y=0.01666666666667
  ----------
    Pyramid levels successfully built for: color_etopo1_ice_full

Operation IMPORT successfully completed
$
Same as in steps 1.b) and 2.b)

Step 4) a final artistic touch

You can now directly check the DB-file using e.g. spatialite_gui; please focus your attention on the raster_coverages table.
This one is a meta-table specifically intended to support Raster Coverages, and is the exact equivalent of what geometry_columns is intended to be for Vector Layers.

raster_coverages #1

As you can easily check, all three Coverages are now nicely registered within the raster_coverages table. Anyway, both the title and abstract columns simply report some unpleasant and meaningless default value.

raster_coverages #2

You are now simply expected to execute just few UPDATE SQL statements, and finally you'll have all your Coverages supported by appropriate and meaningful title and abstract columns, as shown in this figure.

Step 5) starting the light-weight WMS server

RasterLite2 includes a light-weight but almost complete WMS 1.3.0 server. It's a basically simple, zero-admin and absolutely complexity-free component.
$ wmslite -db earth.sqlite

======================================================
              WmsLite server startup
======================================================
         SQLite version: 3.8.4.1
     SpatiaLite version: 4.2.0-devel
    RasterLite2 version: 0.8
======================================================
Publishing layer "truemarble"
Publishing layer "naturalearth"
Publishing layer "etopo1"
======================================================
    HTTP micro-server listening on port: 8080
======================================================
Just execute wmslite from the command shell by specifying the pathname of the DB-file you intend to publish, and that's all.
As you can easily check, now the WMS server is listening on localhost port 8080, and is immediately ready to accept and process standard WMS requests.

Step 6) directly testing your RasterLite2 Coverages via WMS

In this first example we'll use the LibreWMS GUI tool directly accompanying RasterLite2 and completely based on the WMS client internally implemented by librasterlite2.

wms connect #1

You simply have to establish a WMS connection to localhost (aka IP address 127.0.0.1) on the IP port 8080.

wms connect #2

Then you simply have to connect all three Coverages being published as WMS layers, one at each time.

wms test #1

wms test #2

wms test #3

You'll be immediately ready to visualize a full interactive WMS Map; and you could obviously switch on and off each layer at your will.

wms test #4

wms test #5

wms test #6

And you could eventually play a little bit around while testing zoom-in, zoom-out and panning basic capabilities.


Please note: using the LibreWMS tool isn't at all a strict requirement. WMS is expected to be an universal standard protocol, so you could freely us any WMS client at your discretion. You simply have to establish a connection to the following URL, and that should be all that is required in order to test the wmslite server.
http://127.0.0.1:8080/wmslite?service=WMS&request=GetCapabilities
The following figures represents a quick example showing how to connect QGIS to the wmslite server.

QGIS WMS connection #1

QGIS WMS connection #2

QGIS test



Back to RasterLite2 Tutorials index