Elevation layers in templates

From Maria GDK Wiki
Jump to navigation Jump to search

Elevation data can be referenced and visualized in various ways in Maria GDK. This can be done programmatically by the application, or in the template XML files.

Hill shading layers

Available since Maria GDK 3.1.

Pre-generated hill shading

Data referenced in this layer type is generated with the TPG tool

<layer type="ModLayer" name="Normalmapelevations" category="ElevEffects">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>244</minscalevisible>
    <maxscalevisible>128000000</maxscalevisible>
    <description>Elevation shading layer based on prerendered normal maps</description>
    <datasource>
      <mapsignature>norway_normals20m</mapsignature>
      <maptype>RasterMap</maptype>
      <showlabels>true</showlabels>
      <usecache>true</usecache>
    </datasource>
    <visible>true</visible>
  </layer>

On-the-fly hill shading

If you have elevation data active in the application you can generate the hill shading automatically on the fly. To do this, add a ModLayer as above, but with an "ElevationNormals" maptype data source. The map signature value is not significant.

  <layer type="ModLayer" name="Auto shading" category="ElevEffects">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>2000000</maxscalevisible>
    <datasource>
      <mapsignature>AutoShading</mapsignature>
      <maptype>ElevationNormals</maptype>
      <showlabels>false</showlabels>
      <usecache>false</usecache>
    </datasource>
    <shadingparameters>
        <ambient>0.6</ambient>
    </shadingparameters>
    <visible>true</visible>
    <property key="labels:fetchdata" value="false" />
  </layer>


Elevation data layers

Templates can also be used to define a set of elevation data layers used for analysis purposes, such as elevation profiles etc.

These elevation layers are processed in the order they appear in the template file, in such a manner that the first layer that returns a valid result is used. This means that you typically want to place datasets with higher resolution and smaller area first in the file. If your query falls within the high resolution subdataset, you will get result from these data, and if not, it will fall through to the next layer which may for example be a global base elevation grid.

These templates are typically set programmatically through the IElevationData interface.

In the following example, we have a 10m resolution elevation data set that covers Norway first in the template, and a global SRTM dataset as fallback.

  <layer type="ElevationLayer" name="Norge 10m">
    <compression>Any</compression>
    <datasource>
      <mapsignature>elevation10m</mapsignature>
      <maptype>ElevationData</maptype>
      <usecache>false</usecache>
    </datasource>
    <visible>true</visible>
  </layer>

  <layer type="ElevationLayer" name="SRTM30">
    <compression>Any</compression>
    <datasource>
      <mapsignature>globe_elevation</mapsignature>
      <maptype>ElevationData</maptype>
      <usecache>false</usecache>
    </datasource>
    <visible>true</visible>
  </layer>