<h1>Quick How-To Guide for the Planet Earth sample</h1>
In this tutorial we'll assume that you've already studied and understood the tutorials about the <b>Giglio sample</b><br>
Now we'll examine the <b>Planet Earth sample</b> which will allow us to delve further into new details that we previously ignored.
<br><br>
The following table summarizes for quick reference all Coverages contained into the <b>Planet Earth</b> sample database:<br><br>
<table border="1" bgcolor="f0fff0" cellpadding="8" cellspacing="4">
<tr><th bgcolor="#d0d0d0">Coverage name</td><td bgcolor="#d0d0d0">Type</th><th
<tr><td>etopo1</td><td bgcolor="#f0c0a0">Raster</td><td>Global DEM - Digital Elevation
<tr><td>true_marble</td><td bgcolor="#f0c0a0">Raster</td><td>Natural colors - RGB low-resolution mosaic of Landsat
<tr><td>countries</td><td bgcolor="#a0c0f0">Vector</td><td>2D Polygons - National
<tr><td>countries_vw</td><td bgcolor="#a0c0f0">Vector</td><td>Spatial View derived from
<tr><td>topo_states</td><td bgcolor="#a0c0f0">Vector</td><td>Topology derived from
</table>
<br><br>
All datasets are based on <b><i>open available at the following URLs:
<ul>
<li><b>ETOPO1</b>: <a
<li><b>True Marble</b>: <a
<li><b>Countries</b>: <a
</ul>
<br><br><hr><br><br>
<table width="100%" border="1" bgcolor="ffffe8" cellpadding="8" cellspacing="4">
<tr><th bgcolor="#c0ffc0" colspan="2"><h1>Step #1 - General
<tr><td>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
In this first contact with <b>Planet Earth</b> we'll simply test the basic rendering capabilities of the Map.<br><br>
You are simply expected to test the <b>pan</b> and <b>zoom</b> tools while switching on and off the various map layers.

<br><hr>
<h3>Step #1.1 - Testing the ETOPO1 background</h3>
The side figure shows how the Map will be when applying the following layers selection:
<ul>
<li><b>ETOPO1</b> background</li>
<li><b>Countries</b> (<i>National Boundaries - red lines</i>) with labels corresponding to each Nation.
<ul>
<li><b>Note</b>: labels will be printed only if they fit inside the <b>MBR</b> of the corresponding

</ul>
</td><td>
<img alt="fig_ex_dem">

<tr><td>
<h3>Step #1.2 - Testing the True Marble background</h3>
The side figure shows how the Map will be when applying the following layers selection:
<ul>
<li><b>True Marble</b> background</li>
<li><b>Countries</b> (same as above).
</ul>
</td><td>
<img alt="fig_ex_tm">

<tr><td>
<h3>Step #1.3 - Testing the Political Map</h3>
The side figure shows how the Map will be when applying the following layers selection:
<ul>
<li><b>Countries (view)</b> background
<ul>
<li><b>Note</b>: Each Country is internally filled with a different color, in such a way that confining Nations will never share the same color.</li>

<li><b>Countries</b> (same as above).
</ul>
</td><td>
<img alt="fig_ex_pol">

<tr><td>
<h3>Step #1.4 - Testing the Topology</h3>
The side figure shows how the Map will be when applying the following layers selection:
<ul>
<li><b>topo_states (Topology)</b> alone. All Topology Primitives are represented as follows:
<ul>
<li><b>Nodes</b>: red circles.</li>
<li><b>Edges</b>: blue lines.</li>
<li><b>Faces</b>: pale yellow polygons.</li>
<li><b>Face Seeds</b>: yellow stars.</li>
<li><b>Edge Seeds</b>: yellow diamonds.</li>

</ul>
</td><td>
<img alt="fig_ex_topo">

<tr><th bgcolor="#c0ffc0" colspan="2"><h1>Step #2 - Preparing the Raster
<tr><th bgcolor="#d0ffff" colspan="2"><h3>Step #2.1 - Creating the Raster
<tr><td>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
<h4>Useful hint</h4>
Both <b>etopo1</b> and <b>true_marble</b> will be imported from a single GeoTiff.
Using the <b>tiffinfo CLI tool</b> so to check the internal configuration of the input images is warmly recommended.

<br><hr><br>
<h3>Step #2.1.1 - Creating etopo_1</h3>
<ul>
<li>Set sensible values tof <b>Name</b>, <b>Title</b> and
<li>This one is a <b>DEM</b>, and the most appropriate settings are as follows:
<ul>
<li><u><i>Pixel set to
<li><u><i>Sample set to
<li><u><i>Compression set to
set to
set to
<li><u><i>Pixel set to
<li>The <u><i>Strict Resolution has been selected.</li>
</ul>
</li>
</ul>
</td><td>
<img alt="fig1">

<tr><td>
<h3>Step #2.1.2 - Creating true_marble</h3>
<ul>
<li>Set sensible values tof <b>Name</b>, <b>Title</b> and
<li>This one is a <b>RGB</b> image, so the most appropriate settings are as follows:
<ul>
<li><u><i>Pixel set to
<li><u><i>Sample set to
<li><u><i>Compression set to <b>JPEG2000</b> (because it's a rather slow codec, but it preserves a good visual quality at very high compression ratios).</li>
set to <b>5</b> (so to ensure a very good compression ratio without sacrificing too much the visual quality).</li>
set to
set to
<li><u><i>Pixel set to
<li>The <u><i>Strict Resolution has been selected.</li>
</ul>
</li>
</ul>
</td><td>
<img alt="fig3">

<tr><th bgcolor="#d0ffff" colspan="2"><h3>Step #2.2 - Populating the Raster
<tr><td>
On the dialog box:
<ul>
<li>Remember to enable the <b>Immediately build Section Pyramids</b> checkbox</li>
</ul>
<br><hr><br>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
This recipe is valid for both <b>etopo1</b> and <b>true_marble</b>
<br><br>
<b>Note</b>: in this case you should absolutely avoid to select the <b>Forced SRID value</b> and/or <b>With WorldFile support</b> checkbox because we are importing from <b>GeoTiff</b> that internally stores any required information.

</td><td>
<img alt="fig2">

<tr><th bgcolor="#d0ffff" colspan="2"><h3>Step #2.3 - Styling the Raster
<tr><td>
<b>etopo1</b> is Global DEM, presenting elevation values ranging between the ocean depths and the very high peaks of the Himalayas.<br>
The most appropriate choice for the <b>Color Map Style</b> could be either <b>Etopo2</b> or <b>SRTM</b> or <b>Terrain</b>.
<br><hr><br>
<b>Note</b>: setting up a Style for <b>true_marble</b> is not required, because this one is a <b>RGB</b> Coverage, and the <b>default</b> Style will be perfectly adequate.
</td><td>
<img alt="fig33">

<tr><th bgcolor="#c0ffc0" colspan="2"><h1>Step #3 - Preparing the Vector
<tr><th bgcolor="#d0ffff" colspan="2"><h3>Step #3.1 - Styling countries (Spatial
<tr><td>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
This recipe is valid for both <b>etopo1</b> and <b>true_marble</b>
<br><br>
There is very little to say about creating and populating the <b>countries</b> Spatial Table, because we'll just import the <b>Shapefile</b> downloaded from <b>Natural Earth</b>.<br><br>
Then transforming this Spatial Table into a corresponding Vector Coverage should be a trivial task; if you have doubts about this passage you just have to return to the previous tutorial.<br><br>
So we'll focus out attention just on the Style, that is a little bit more elaborate then usual.

<br><hr><br>
<h3>Step #3.1.1 - Setting up the Polygon Symbolizer</h3>
On the <b>QuickStyle</b> Dialog Box:
<ul>
<li>open the <b>Polygon Symbolizer</b> tab.</li>
<li>be sure to <b>disable</b> the <b>Fill</b> option.</li>
<li>enable the <b>Stroke</b> option.
<ul>
<li><b>Note</b>: this way we'll get <b>hollow polygons</b>, completely lacking any internal filling, so to preserve fully visible the underlaying Raster.</li>

<li>and finally press the <b>Ok</b> button so to confirm.</li>
</ul>
</td><td>
<img alt="fig31">

<tr><td>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
We've not yet finished.<br>
Now we'll add a <b>second Symbolizer</b> to the current Style, and it will exactly be a <b>Text Symbolizer</b><br><br>
This way each polygon will have the name of the corresponding Nation printed on its surface.

<br><hr><br>
<h3>Step #3.1.2 - Setting up the Text Symbolizer</h3>
On the <b>QuickStyle</b> Dialog Box:
<ul>
<li>open the <b>Text Symbolizer</b> tab.</li>
<li>be sure to enable the <b>Labels</b> option.</li>
<li>select from the list the name of the <b>Column</b> containing the values to printed as labels (in this case
<li>Choose some <b>Font</b> from the list
<ul>
<li><b>Note</b>: all fonts accessible to <b>RasterLite2</b> must be stored into the <b>SE_fonts</b> table.<br>
You'll find some user friendly wizards making easier handling Fonts in the context menu associated to the <b>Styling node on the Tree Control.<br>
Few <b>Toy Fonts</b> are always available because they are directly embedded in the code.</li>

<li>Set an appropriate <b>Font Size</b> and select the <b>Bold</b> option for better readability.</li>
<li>Enable the <b>Font Halo</b> option and specifiy a very thin <b>Radius</b>
<ul>
<li><b>Note</b>: for what concerns <b>Colors</b> we've set <b>white text</b> surrounded by a narrow <b>black</b> halo so to unsure a good readability on every background.</li>

<li>and finally press the <b>Ok</b> button so to confirm.</li>
</ul>
</td><td>
<img alt="fig32">

<tr><th bgcolor="#d0ffff" colspan="2"><h3>Step #3.2 - Creating and styling a Vector Coverage based on a Spatial
<tr><td>
<h3>Step #3.2.1 - Creating the Spatial View</h3>
There is very little to say about this; we simply have to execute a pair of SQL statements.<br><br>
What is decisely more interesting to be examined is the intended role of the <b>CASE</b> clause:
<ul>
<li>if you quicly examine the <b>countries</b> table you'll discover the presence of a Column named
<li>as you can easily check, all values in this column range from <b>1</b> to
<li><b>Short conclusion</b>: that <b>mapcolor7</b> column is specifically intended to contain <b>color indices</b> allowing to easily style a Political Map of the World.</li>
<li>So in our View we simply have to transform each <b>color index</b> into a corresponding <b>HTML hex color</b>, and exactely this is the intended scope of the <b>CASE</b> clause.</li>
</ul>
</td><td>
<verbatim>
CREATE VIEW countries_vw AS
SELECT pk_uid AS rowid, name AS name,
    CASE mapcolor7
        WHEN 1 THEN '#FF0000'
        WHEN 2 THEN '#00FF00'
        WHEN 3 THEN '#0000FF'
        WHEN 4 THEN '#FFFF00'
        WHEN 5 THEN '#FF00FF'
        WHEN 6 THEN '#00FFFF'
        ELSE '#808080'
    END color, geometry AS geom
FROM countries;

INSERT INTO views_geometry_columns VALUES
    ('countries_vw', 'geom', 'rowid', 'countries', 'geometry', 1);
</verbatim>

<tr><td>
<h3>Step #3.2.2 - Transforming a Spatial View into a Vector Coverage</h3>
From the Tree View expand the <b>Spatial View</b> node, then go to its <b>Geometry</b> node:
<ul>
<li>press the <b><i>mouse right
<li>a context menu will be displayed on the screen</li>
<li>Click the <b>Create Vector Coverage</b> menu item</li>
</ul>
</td><td>
<img alt="fig4">

<tr><td>
<table bgcolor="#ffd080" cellpadding="14"><tr><td>
<b>Note</b>: the Style we'll go to create is not directly supported by any wizard; it strictly requires to be hand-written.<br>
Don't be afraid because it will be extremely simple and easy.
<ol>
<li>first of all use the <b>QuickStyles</b> wizard in order to create a generic <b>Polygon
<li>then <b>export</b> the XML code into an external file.</li>
<li>and finally open a <b>text editor</b> whatsoever so to manually complete the Style.</li>
</ol>

<br><hr><br>
<h3>Step #3.2.3 - Styling the countries_vw Vector Coverage</h3>
How to edit the XML template:
<ul>
<li>you'll start as usual by setting appropriate values to <b>Name</b>, <b>Title</b> and
<li>now you just are required to set the <b>fill parameter</b> as
<ul>
this one is a <b>special notation</b> (not supported by standard SLD/SE specifications), intending that <b>RasterLite2</b> will find the actual value to be used into the Column of the current feature whose name matches the string enclosed between the two markers.</li>

</ul>
</td><td>
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<PolygonSymbolizer version="1.1.0"


    <Name><font color="red"
    <Description>
        &lt;Title><font color="red" size="+2"><b>Countries - Political
        <Abstract><font color="red" size="+2"><b>A Style setting its Fill color from a Column
    </Description>
    <Fill>
        <SvgParameter name="fill"><font color="red"
        <SvgParameter name="fill-opacity">1.00</SvgParameter>
    </Fill>
    <Stroke>
        <SvgParameter name="stroke">#000000</SvgParameter>
        <SvgParameter name="stroke-opacity">1.00</SvgParameter>
        <SvgParameter name="stroke-width">1.00</SvgParameter>
        <SvgParameter name="stroke-linejoin">round</SvgParameter>
        <SvgParameter name="stroke-linecap">round</SvgParameter>
    </Stroke>
</PolygonSymbolizer>
</pre>


<tr><th bgcolor="#d0ffff" colspan="2"><h3>Step #3.3 - Creating and styling a Vector Coverage based on a
<tr><td>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
<h4>Useful hint</h4>
If you ignore absolutely everything about <b>Topology</b> perhaps it would be advisable that you read the <a first.<br><br>

<br><hr><br>
<h3>Step #3.3.1 - How to create a Topology</h3>
From the <b>Topology-Geometry</b> node in the Tree View:
<ul>
<li>press the <b><i>mouse right
<li>a context menu will be displayed on the screen</li>
<li>Click the <b>Create New Topology-Geometry</b> menu item</li>
</ul>
</td><td>
<img alt="fig5">

<tr><td>
<h3>Step #3.3.2 - Creating the Topology</h3>
On the dialog box:
<ul>
<li>set a <b>Topology
<li>set an appropriate
<li>select <b>2D</b> dimensions</li>
<li>set <b>Tolerance</b> to zero</li>
<li>and finally press the <b>Create</b> button in order to confirm</li>
</ul>
</td><td>
<img alt="fig6">

<tr><td>
<h3>Step #3.3.3 - Building the Topology</h3>
There is very little to say, it just requires executing few SQL statements.
</td><td>
<verbatim>
SELECT TopoGeo_FromGeoTableNoFaceExt('topo_states', NULL, 'countries', NULL, 'dustbin', 'dustbin_view', 512);

SELECT TopoGeo_Polygonize('topo_states');

SELECT TopoGeo_UpdateSeeds('topo_states');
</verbatim>

<tr><td>
<h3>Step #3.3.4 - Transforming a Topology into a Vector Coverage</h3>
From the <b>Topology-Geometry</b> node in the Tree View:
<ul>
<li>expand the node so to make all Topologies visible
<ul>
<li>from the child node corresponding to the intended Topology:
<ul>
<li>press the <b><i>mouse right
<li>a context menu will be displayed on the screen</li>
<li>Click the <b>Create Topology Coverage</b> menu item</li>


</ul>
</td><td>
<img alt="fig7">

<tr><td>
<table bgcolor="#80ffd0" cellpadding="14"><tr><td>
A Vector Coverage based on some Topology is someway exceptional, because it groups several different classes of <b>Primitives</b>:
<ul>


<li><b>Face
<li><b>Edge
</ul>
<br>
<ol>
<li>Each one of them requires a specific Symbolizer.</li>
<li>All them will be switched on and off at the same time, because all them are considered as parts of the same layer.</li>
<li><b>Conclusion</b>: the handling of Topology-based Coverages is someway exceptional, and requires special precautions.</li>
</ol>
<br>
<b>Note</b>: more or less the same applies to <b>Network</b>-based Coverages (that will not be illustrated in any tutorial).

<br><hr><br>
<h3>Step #3.3.5 - Handling a Topology-based Vector Coverage</h3>
From the <b>main.topo_states</b> node in the Tree View:
<ul>
<li>press the <b><i>mouse right
<li>a context menu will be displayed on the screen</li>
<li>Both the <b>Configure</b> and <b>QuickStyles Edit</b> menu items influences the behavior of this Coverage</li>
</ul>
</td><td>
<img alt="fig7">

<tr><td>
<h3>Step #3.3.6 - Handling the visibily of individual Topology Primitives</h3>
On the <b>Configuration</b> Dialog Box you can select / unselect the checkbox corresponding to each single <b>Primitive</b><br>
Any disabled Privitive class will never be shown on the Map.
<br><br>
<b>Note</b>: the <b>Faces Primitive</b> is usually kept disabled, because Topology Faces are simply <b>virtual</b> thus being very slow to be generated on the fly.<br>
If the current viewpoint of the Map contains a reasonable number of Faces showing them could be acceptable.<br>
But when the current viepoint contains a really huge number of Faces updating the Map will probably require an absolutely unacceptable time. You are warned, be very careful.
</td><td>
<img alt="fig9">

<tr><td>
<h3>Step #3.3.7 - Styling a Topology-based Vector Coverage</h3>
Styling a Topology-based Coverage isn't at all difficult, it's just a little bit more complex than usual because you are required to define 5 different Symbolizers, one for each Primitive.
</td><td>
<img alt="fig8">

</table>