Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Artifact ID: | 511cbbeabb8383170e6f21ef2f61640574c56685 |
---|---|
Page Name: | planetEarth |
Date: | 2014-04-03 16:05:06 |
Original User: | sandro |
Parent: | 8de6a94f20dc17aae590fa4cd24e59df36d52947 (diff) |
Next | 1e566279bcceb4e9e5e956589285a3144696b21a |
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.- True Marble 2km: a worldwide synthetic collage of many Landsat cloud-free scenes.
- Natural Earth I: a worldwide land cover presented with a light, natural palette and supporting Shaded Relief, Water and Drainages.
- color ETOPO1: a pre-rendered Global Relief Model released from NOAA.
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 $
- we'll invoke from the command shell the rl2tool; this CLI tool is specifically intended to administer RasterLite2 datasources.
- in this case we'll pass the following arguments (explained one by one):
- CREATE this main keyword intends that we are trying to create a new, empty Coverage.
- -db earth.sqlite this specifies the target DB-file pathname; in this first example the DB-file doesn't yet exists, so it will be implicitly created at once.
- -cov TrueMarble this specifies the individual Coverage's name.
- -smp UINT8 this specifies the Coverage's Sample Type.
- -pxl RGB this specifies the Coverage's Pixel Type.
- -cpr JPEG this specifies that all Tiles in this Coverage must be JPEG compressed.
- -srid 4326 this specifies the Coverage's SRID.
- -res 0.0166666666666667 this specifies the Coverage's base level resolution.
- rl2tool reports a full success, so we'll now duly pass to the next step.
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 $
- same as above; we'll invoke yet another time rl2tool.
- in this case we'll pass the following arguments (explained one by one):
- IMPORT this main keyword intends that we are trying to populate an already created Coverage by importing from an external datasource.
- -db and -cov: same as above.
- -src TrueMarble.2km.21600x10800.tif this specifies the pathname of the external datasource to be imported.
- -pyr this specifies that we do actually intend to immediately build any possible Pyramid Level.
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.

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.

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.
You simply have to establish a WMS connection to localhost (aka IP address 127.0.0.1) on the IP port 8080.

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



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.



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=GetCapabilitiesThe following figures represents a quick example showing how to connect QGIS to the wmslite server.



Back to RasterLite2 Tutorials index