Raster Layers

Since a raster layer has no attributes or vector styles, it's configuration is quite different from a vector layer. Some parameters are of course required for both types (such as a label), while some are specific for the raster type. On this page, we will try to explain the possibilities you have in creating a raster layer definition.

We will start with the basic XML tag for a raster layer. Note that it holds an ID-tag, which should always be unique!

<layer xmlns="http://geomajas.org/schemas/configuration/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        id="unique_id"
	xsi:type="rasterLayerInfo">
...

We will now go over all the parameters one by one. Note that all parameters are case sensitive! We start with the general parameters. You will find that a vector layer starts with the same parameters.

  • label: The visual name of a layer.
  • visible: Should this layer be visible on startup or not? (true or false)
  • layerType: Geometry type of a layer, except for raster layers, where this value should be '0'.
  • crs: Coordinate reference system. Always starts with "EPSG:".
  • viewScale: Viewing scales between which this layer is visible. When a maps zooms in or out beyond the minimum and maximum viewScale, the layer will automatically be invisible.
    • min: The minimun viewScale.
    • max: The maximum viewScale.
  • maxExtent: The maximum viewing extent for a layer. Beyond these borders, the layer will not be visible. Expressed in coordinates from the previously chosen CRS.
    • minX: Minimum X value for the maximum viewing extent.
    • maxX: Maximum X value for the maximum viewing extent.
    • minY: Minimum Y value for the maximum viewing extent.
    • maxY: Maximum Y value for the maximum viewing extent.
  • maxTileLevel: The maximum numbers of levels the tilecache can go deep. 

Now on to the raster layer specific parameters:

  • rasterLayerFactoryRef: The name of the rasterLayerFactory, defined in the application.xml that you whish to use.
  • layerName: The name of the layer for data retrieval. The rasterLayerFactory needs to recognize this name. If you are using OpenStreetMaps, you can leave this blank. If you are using Google, you can choose between "G_NORMAL_MAP" or "G_SATELLITE_MAP". If you are using a WMS server, the layerName you choose here will be used in the WMS retrieval URL.
  • tileWidth: Absolute width in pixels for each tile.
  • tileHeight: Absolute height in pixels for each tile.
  • style: Opacity value for the raster layer. Should be a value between 0 and 1.
  • resolutions (optional): If you want, you can define fixed resolutions to which the rasters should snap. This can sometimes result in clearer WMS images, but this has also an effect on the zooming steps! 

 

Example 

Below is an example of a raster layer, taken from the online samples, that show an Open Street Maps raster layer.

<layer xmlns="http://geomajas.org/schemas/configuration/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="osm"
	xsi:type="rasterLayerInfo">

	<label>OpenStreetMap</label>
	<visible>true</visible>
	<layerType>1</layerType>
	<crs>EPSG:900913</crs>
	<viewScale>
		<min>0</min>
		<max>50</max>
	</viewScale>
	<maxExtent>
		<minX>-20037508.34</minX>
		<maxX>20037508.34</maxX>
		<minY>-20037508.34</minY>
		<maxY>20037508.34</maxY>
	</maxExtent>
	<maxTileLevel>16</maxTileLevel>

	<rasterLayerFactoryRef>osm</rasterLayerFactoryRef>
	<layerName></layerName>
	<tileWidth>256</tileWidth>
	<tileHeight>256</tileHeight>
	<style>1</style>

	<resolutions>
		<resolution>156543.03</resolution>
		<resolution>78271.52</resolution>
		<resolution>39135.76</resolution>
		<resolution>19567.88</resolution>
		<resolution>9783.94</resolution>
		<resolution>4891.97</resolution>
		<resolution>2445.98</resolution>
		<resolution>1222.99</resolution>
		<resolution>611.49</resolution>
		<resolution>305.75</resolution>
		<resolution>152.874057</resolution>
		<resolution>76.4370283</resolution>
		<resolution>38.2185141</resolution>
		<resolution>19.1092571</resolution>
		<resolution>9.55462853</resolution>
		<resolution>4.77731427</resolution>
		<resolution>2.38865713</resolution>
		<resolution>1.19432857</resolution>
	</resolutions>

</layer>