Web layers in templates

From Maria GDK Wiki
Jump to navigation Jump to search

In map templates, web map layers can be set up to access various types of web map services. From Maria GDK version 3.2, accessing web maps is handled by the client. In earlier versions, this was handled by a separate Windows service (add-in).

Example

This is an example template with various types of web map layers:

<compositemaptemplate name="WebMaps" id="e72fe7f2-65c3-474a-beb7-b8ad92614bd4" type="basemap">
 
  <!-- This is an OGCWMS layer accessing publicly available maps from Kartverket  -->
 
  <layer type="MapLayer" name="OGCWMSMap">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>128000000</maxscalevisible>
    <datasource>
      <mapsignature>wms</mapsignature>
      <maptype>WmsMap</maptype>
      <showlabels>false</showlabels>
      <layergroupfilter>Landareal</layergroupfilter>
      <layergroupfilter>1_nautisk_mil</layergroupfilter>
      <layergroupfilter>Fiskerigrense</layergroupfilter>
      <usecache>false</usecache>
      <property key="serviceType" value="OGCWMSMap" />
      <property key="ogcUri" value="https://wms.geonorge.no/skwms1/wms.nmg?" />
      <property key="ogcCrs" value="EPSG:32633" />
    </datasource>
    <visible>true</visible>
    <property key="coverage:show" value="false" />
    <property key="labels:fetchdata" value="false" />
    <property key="isusermanageable" value="false" />
  </layer>
 
 
  <!-- This is a web map layer accessing the publicly available Open Street service -->
 
  <layer type="MapLayer" name="Openstreetmap">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>256000000000</maxscalevisible>
    <datasource>
      <mapsignature>wms</mapsignature>
      <maptype>WmsMap</maptype>
      <showlabels>false</showlabels>
      <property key="serviceType" value="MercatorTiled" />
      <property key="tileReferenceMethod" />
      <property key="subDomains" value="a,b,c" />
      <property key="urlWithPlaceholders" value="https://tile.openstreetmap.org/{z}/{x}/{y}.png" />
    </datasource>
    <visible>true</visible>
    <ispreliminary>false</ispreliminary>
    <property key="resampling" value="linear" />
    <property key="coverage:show" value="false" />
    <property key="isusermanageable" value="false" />
  </layer>
 
  <!-- This is a web maps layer accessing an OGCWMTS service -->
 
  <layer type="MapLayer" name="OGCWMTSMap">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>128000000</maxscalevisible>
    <datasource>
      <mapsignature>wms</mapsignature>
      <maptype>WmsMap</maptype>
      <showlabels>false</showlabels>
      <usecache>false</usecache>
      <property key="serviceType" value="OGCWMTSMap" />
      <property key="wmtsTileMatrixSet" value="EPSG:3857" />
      <property key="wmtsLayer" value="toporaster3" />
      <property key="ogcUri" value="http://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?" />
    </datasource>
    <visible>true</visible>
    <property key="coverage:show" value="false" />
    <property key="labels:fetchdata" value="false" />
    <property key="isusermanageable" value="false" />
  </layer>

  <!-- This is a web maps layer accessing a TMS service without subdomains -->

  <layer type="MapLayer" name="Hike_bike_TMS">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>128000000</maxscalevisible>
    <datasource>
      <mapsignature>wms</mapsignature>
      <maptype>WmsMap</maptype>
      <showlabels>false</showlabels>
      <usecache>false</usecache>
      <property key="serviceType" value="MercatorTiled" />
      <property key="urlWithPlaceholders" value="http://toolserver.org/tiles/hikebike/{z}/{x}/{y}.png"/>
      <property key="tileReferenceMethod" value="XYZTopLeft" />
    </datasource>
    <visible>true</visible>
    <property key="coverage:show" value="false" />
    <property key="labels:fetchdata" value="false" />
    <property key="isusermanageable" value="false" />
  </layer>

  <!-- This is a web maps layer accessing a TMS service with three subdomains -->

  <layer type="MapLayer" name="Humanitarian_OSM_TMS">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>128000000</maxscalevisible>
    <datasource>
      <mapsignature>wms</mapsignature>
      <maptype>WmsMap</maptype>
      <showlabels>false</showlabels>
      <usecache>false</usecache>
      <property key="serviceType" value="MercatorTiled" />
      <property key="urlWithPlaceholders" value="http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png "/>
      <property key="tileReferenceMethod" value="XYZTopLeft" />
      <property key="subDomains" value="a,b,c" />
    </datasource>
    <visible>true</visible>
    <property key="coverage:show" value="false" />
    <property key="labels:fetchdata" value="false" />
    <property key="isusermanageable" value="false" />
  </layer>

  <!-- This is a web maps layer accessing a TMS service where tiles are referenced with a QuadKey -->

  <layer type="MapLayer" name="VirtualEarth_TMS">
    <opacity>1</opacity>
    <brightness>0</brightness>
    <gamma>1</gamma>
    <contrast>0</contrast>
    <grayscale>false</grayscale>
    <compression>Any</compression>
    <minscalevisible>1</minscalevisible>
    <maxscalevisible>128000000</maxscalevisible>
    <datasource>
      <mapsignature>wms</mapsignature>
      <maptype>WmsMap</maptype>
      <showlabels>false</showlabels>
      <usecache>false</usecache>
      <property key="urlWithPlaceholders" value="http://t{s}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=1398"/>
      <property key="subDomains" value="0,1,2,3,4" />
      <property key="tileReferenceMethod" value="QuadKey" />
    </datasource>
    <visible>true</visible>
    <property key="coverage:show" value="false" />
    <property key="labels:fetchdata" value="false" />
    <property key="isusermanageable" value="false" />
  </layer>
 
</compositemaptemplate>

Datasource

The datasource element has the following sub-elements which are relevant for web maps:

Element Valid values Description
mapsignature WMS Tag used to identify the element as a Web Maps Layer.
maptype WmsMap Mandatory maptype key.
layergroupfilter <layerid> A valid layer id. Only used in WMS layers. Use one layergroupfilter element for each layer to include from the WMS service.
property Uses the attributes key and value to specify web map type.

Property

The property elements have uses key and value attributes to further specify the type of web map:

Key Valid values Description
serviceType OpenstreetMap, OGCWMSMap, OGCWMTSMap, MercatorTiled Mandatory service type identifier. The value must be one of those listed.

OpenstreetMap

Connects to the Openstreetmap standard tile layer

Key Valid values Description
serviceType OpenstreetMap
osMapStyle standard The standard tile layer of Openstreetmap, using the "Openstreetmap Carto" stylesheet.

OGCWMSMap

Connects to a Web Map Service

Key Valid values Description
serviceType OGCWMSMap
ogcUri Service URL Mandatory URL to the service
ogcVersion OGC version identifier Optional value for a preferred version
ogcCrs CRS code Optional code for a preferred coordinate system

OGCWMTSMap

Connects to a Web Map Tile Service

Key Valid values Description
serviceType OGCWMTSMap
ogcUri Service URL Mandatory URL to the service
ogcVersion OGC version identifier Optional value for a preferred version
wmtsLayer <layer name> A valid layer name just as it appears in the server capabilities section.
wmtsTileMatrixSet <tile matrix set> A valid tile matrix set identifier chosen among the ones supported for the selected layer, as stated by the server capabilities document.

MercatorTiled

Connects to a Tile Server (also called "TMS" or "slippy map")

Key Valid values Description
serviceType MercatorTiled
urlWithPlaceholders Service URL Mandatory URL to the service. Should contain placeholders for zoom level and X,Y coordinates in the form {z}/{x}/{y}. Can also contain a placeholder for subdomain {s}.
tileReferenceMethod XYZTopLeft, XYZBottomLeft, QuadKey Method for referencing tiles.
subDomains List of available subdomains Comma-separated list of subdomains, for instance "a,b,c". Generally several subdomains (server names) are provided to get around limitations on the number of simultaneous HTTP connections to each host. Applications can thus request multiple tiles from multiple subdomains faster than from one subdomain.