Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Current »

The tiled map engine is used to support cached map services that provide tiles to the browser to draw the maps, as opposed to generating a complete map image.

Current Restrictions

When using a tiled map engine the scales/resolutions used by the client must match exactly those provided by the tiles, which also implies that you can not mix tiled map engines that have different resolutions for their tiles.

As of 2.5.28 this is not necessarily true, it's now possible to specify the resolutions of the server tiles separately and Weave will choose the closest.


If more than one crs, format or layer from a tiled map service is needed then multiple map engines must be created, each specifying a different crs, format or layer. Each tiled map engine can only represent a single map layer.

Performance/Quality improvements

As of 2.6.4 you can specify if a tiled map engine should aim for performance or quality when re-projecting tiles and also how many tiles should be fetched at in parallel.

reprojectMode can be set to default, speed or quality, and defaults to default if not set, which is a balance between the two (but speed is still significantly quicker than both default and quality).

fetchThread, which defaults to 1, specifies how many tiles will be fetched at once from the back end tile provider. More threads mean better performance, but it currently defaults to 1 since it's a new feature.

<tiled:mapengine id="osm">
	<type>osm</type>
	<format>image/png</format>
	<url>//a.tile.openstreetmap.org/${z}/${x}/${y}.png</url>
	<url>//b.tile.openstreetmap.org/${z}/${x}/${y}.png</url>
	<url>//c.tile.openstreetmap.org/${z}/${x}/${y}.png</url>
	<reprojectMode>speed</reprojectMode>
	<fetchThreads>8</fetchThreads>
</tiled:mapengine>

GeoWebCache

Example tiled map engine configuration
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns='urn:com.cohga.server.config#1.0' xmlns:tiled="urn:com.cohga.server.map.tiled#1.0">

	<tiled:mapengine id="mapengine.tiled">
		<type>gwc</type>
		<url>http://mapserver/geowebcache/service/wms?TILED=true</url>
		<username>user</username>
		<password>ENCAZEPAMMBZAAUTUPMABFJEBZJAKFCXGME</password>
		<crs>EPSG:3857</crs>
		<format>image/jpeg</format>
		<layer>aerialphoto_2014_10_15</layer>

<!-- retry settings added at 2.6.10 -->
<!-- below are the default values for these settings, so you do not need to add any of these unless you want to change them from these values -->

<!-- should we retry the connection after failure, true is the default so you don't need this unless you want to disable retrying and just immediately fail -->
		<retry>true</retry>

<!-- number of seconds to wait before retrying, 15 is the default so you don't need this unless you want a longer/shorter period -->
		<retryDelayInSeconds>15</retryDelayInSeconds>

<!-- maximum number of retries to attempt before giving up. 0 means continue to retry forever and is the default so you don't need this unless you want to stop retrying after a certain number of failures -->
		<retryCount>0</retryCount>

<!-- number of minutes, from first failure, to retry before giving up. 0 mean there is no timeout and to retry forever and this is the default so you don't need this unless you want to stop retrying after a certain number of minutes -->
		<retryTimeoutInMinutes>0</retryTimeoutInMinutes>

	</tiled:mapengine>
 
</config>

The above example shows how to create a GeoWebCache tiled map engine.

The type attribute defaults to "gwc" ("geowebcache" can also be used) and determines how the tiles are handled by the client.

The url points to where the capabilities document for the tile service can be downloaded from. Generally with GeoWebCache tiled services it's a regular WMS url with the TILED=true parameter included.

The username and password are optional (the password had been encrypted with the encrypt command at the osgi console) and should be used if the service requires authentication.

The crs parameter is required and specifies what coordinate reference system the tiles are projected in.

The format parameter is required and specifies what image format the tiles are presented as.

The layer parameter is required and specifies the layer within the service that should be used.

OpenStreetMap

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns='urn:com.cohga.server.config#1.0' xmlns:tiled="urn:com.cohga.server.map.tiled#1.0">

	<tiled:mapengine id="mapengine.tiled">
		<type>osm</type>
		<url>http://a.tile.openstreetmap.org/${z}/${x}/${y}.png</url>
		<url>http://b.tile.openstreetmap.org/${z}/${x}/${y}.png</url>
		<url>http://c.tile.openstreetmap.org/${z}/${x}/${y}.png</url>
		<format>image/png</format>
		<layer>0</layer>
		<label>image</label>
		<!-- The items shown here are the defaults and are just included to show what can be changed.
			Do not just cut and paste the following unless you intend changing it, and do not
	        change it unless you know what you are doing. -->
		<tile>
			<resolutions>156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,...<full list missing for brevity>...,0.5971642833948135</resolutions>
			<tileWidth>256</tileWidth>
			<tileHeight>256</tileHeight>
		</tile>
		<envelope crs="EPSG:3857" minx="-20037508.34" miny="-20037508.34" maxx="20037508.34" maxy="20037508.34" />
	</tiled:mapengine>
 
</config>

The above example shows how to create a OpenStreetMap (OSM) tiled map engine.

The type attribute defaults to "osm" ("openstreetmap" can also be used) and determines how the tiles are handled by the client.

The url points to where the tiles can be downloaded from, and must include place holders for the x, y and z values.

The format parameter is optional and specifies what image format the tiles are presented as. The default format is "image/jpeg".

The layer parameter is optional and specifies what will be used as the layer id. The default is "0".

The label parameter is optional and specifies what will be used as the layer name. The default is "image".

The tile parameter is optional and specifies settings related to the tiles provided. The default is set according to the OSM spec, and should only be changed if you're using your own OSM tiles.

The envelope parameter is optional and specifies the extent of the tiles. The default is set according to the OSM spec, and should only be changed if you're using your own OSM tiles.

Here

Please refer to the Here Developer Portal for more information about licensing and pricing https://developer.here.com/

See the documentation for the Map Tile REST Service offered by Here https://developer.here.com/documentation/map-tile/dev_guide/topics/introduction.html

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns='urn:com.cohga.server.config#1.0' xmlns:tiled="urn:com.cohga.server.map.tiled#1.0">

  <?set HERE_APP_ID=YOUR_APP_ID?>
  <?set HERE_APP_CODE=YOUR_APP_CODE?>

  <tiled:mapengine id="mapengine.here.normal.day">
        <type>osm</type>
        <url><![CDATA[https://1.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <url><![CDATA[https://2.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <format>image/png</format>
        <layer>0</layer>
        <label>Here Streetmap</label>
  </tiled:mapengine>
  
  <tiled:mapengine id="mapengine.here.satellite.day">
        <type>osm</type>
        <url><![CDATA[https://1.aerial.maps.api.here.com/maptile/2.1/maptile/newest/satellite.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <url><![CDATA[https://2.aerial.maps.api.here.com/maptile/2.1/maptile/newest/satellite.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <format>image/png</format>
        <layer>0</layer>
        <label>Here Satellite</label>
  </tiled:mapengine>
  
  <tiled:mapengine id="mapengine.here.hybrid.day">
        <type>osm</type>
        <url><![CDATA[https://1.aerial.maps.api.here.com/maptile/2.1/maptile/newest/hybrid.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <url><![CDATA[https://2.aerial.maps.api.here.com/maptile/2.1/maptile/newest/hybrid.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <format>image/png</format>
        <layer>0</layer>
        <label>Here Hybrid</label>
  </tiled:mapengine>
  
  
  <tiled:mapengine id="mapengine.here.terrain.day">
        <type>osm</type>
        <url><![CDATA[https://1.aerial.maps.api.here.com/maptile/2.1/maptile/newest/terrain.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <url><![CDATA[https://2.aerial.maps.api.here.com/maptile/2.1/maptile/newest/terrain.day/${z}/${x}/${y}/256/png8?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}]]></url>
        <format>image/png</format>
        <layer>0</layer>
        <label>Here Terrain</label>
  </tiled:mapengine>

</config>

Google

You can also access Google map tiles using the same algorithm as OpenStreetMap.

The following shows how to create a map engine to represent each of the display types that Google provides tiles for. Once this is done, the map engines can be treated like any other tiled map engine and be added to a toc model and a client config.

The URLs contain special characters so these need to be escaped, or CDATA can be used to ensure they are interpreted correctly. Examples of both are shown below. 

Note if you notice Google tiles using a different language then add &hl=en to the end of the URL (for English)

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns='urn:com.cohga.server.config#1.0' xmlns:tiled="urn:com.cohga.server.map.tiled#1.0">

	<tiled:mapengine id="google.standard">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=m&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=m&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=m&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>

	<tiled:mapengine id="google.satellite">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=s&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=s&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=s&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>

	<tiled:mapengine id="google.alt">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=r&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=r&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=r&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>

	<tiled:mapengine id="google.terrain">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=t&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=t&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=t&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>

	<tiled:mapengine id="google.alt.terrain">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=p&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=p&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=p&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>

	<tiled:mapengine id="google.roads">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=h&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=h&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=h&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>

	<tiled:mapengine id="google.hybrid">
		<type>osm</type>
		<format>image/png</format>
		<url><![CDATA[//mt0.google.com/vt/lyrs=y&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt1.google.com/vt/lyrs=y&x=${x}&y=${y}&z=${z}]]></url>
		<url><![CDATA[//mt2.google.com/vt/lyrs=y&x=${x}&y=${y}&z=${z}]]></url>
	 </tiled:mapengine>
 
</config>

Note: Before using the Google Map Service, please ensure you read through the Google Maps Terms of Service and ensure that you have correctly setup licensing with Weave.

ArcGIS

There are two ArcGIS specific methods of providing tile cache support to Weave clients. The method outlined here is specifically provided to support exposing a local compressed ArcGIS map service tile cache, i.e. a tile cache created by ArcGIS where the tiles are stored in the compressed format (with .bundle, or with .bundle and .bundlx files) on the local file system of the Weave server. If this is not your situation then you should use the ArcGIS specific map engine to expose the tiles (see Map Engine ArcGIS (REST) or Map Engine ArcGIS (SOAP)).

For the ArcGIS tiles map engine the type value should be set to arcgis and a tilingScheme value must be provided that points to the local conf.xml file.

Note this requires Weave 2.6.6 or later.

Exposing compressed ArcGIS tile cache
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns='urn:com.cohga.server.config#1.0' xmlns:tiled="urn:com.cohga.server.map.tiled#1.0">

	<tiled:mapengine id="ags.tiled.aerial10cm">
		<type>arcgis</type>
		<tilingScheme>/data/spatial/raster/aerial10cm/Layers/conf.xml</tilingScheme>
	</tiled:mapengine>

</config>

Client

Once the map engine is created it must be added to a ToC model and client map view the same as any other map engine. The client map engine configuration should specify only the map engine id. Weave provides all of the parameters required to configure the map engine and it obtains these by processing the 'capabilities document' of the map service.

Example showing embedding of tiled map engine in a client map view
<view id='com.cohga.html.client.map.mapView'>
	<mapEngine id="mapengine.tiled"/>
	<mapEngine id="mapengine.vector"/>
	<mapEngine id="mapengine.selection">
		<options>
			<selection>true</selection>
		</options>
	</mapEngine>
	<!-- resolutions should match tiled map engine -->
	<resolutions>156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,...full list missing for brevity...,0.5971642833948135</resolutions>
	<!-- CRS should match tiled map engine -->
	<crs>EPSG:3857</crs>
</view>

Tile Subsets

It's possible to use a subset of tiles in the client that does not cover the entire zoom range available in that tile set. For example, if you're using a Google tile set and the corresponding resolutions, there are on average 20 different zoom levels available. However you might wish to include your own local tile set that cover a subset of those 20 zoom levels. Or, if you're using the Google or OpenStreetMap tile sets, you might want to limit the user to a smaller zoom range and not allow them to zoom out beyond a certain level. Both of these situations can be catered for in Weave. 

To include your local tile set you need to configure the map engine to tell it at which zoom level it should start at and how many zoom levels it covers, otherwise it will assume that it starts at zoom level 0 and has 20 zoom levels available (assuming that you've setup the client with the default Google zoom levels).

This is done by setting the numZoomLevels and zoomOffset options for the map engine. Also you may need to reduce the number of resolutions listed for the map view.

For example, if we wanted to update the map view example above so that the user can only access the first 8 zoom levels, we set numZoomLevels to 8 and set zoomOffset to 12 (20, the default number of zoom levels for the map view, minus 8) and then change the client map view resolutions list to only include the resolutions we want to enable.

Tile subset example
<view id='com.cohga.html.client.map.mapView'>
	<mapEngine id="mapengine.tiled">
		<options>
			<numZoomLevels>8</numZoomLevels>
			<zoomOffset>12</zoomOffset>
		</options>
	</mapEngine>
	<mapEngine id="mapengine.vector"/>
	<mapEngine id="mapengine.selection">
		<options>
			<selection>true</selection>
		</options>
	</mapEngine>
	<!-- resolutions should match tiled map engine -->
	<resolutions>38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135, 0.298582142</resolutions>
	<!-- CRS should match tiled map engine -->
	<crs>EPSG:3857</crs>
</view>

Alternatively, if you still wanted to allow 8 zoom levels but wanted to skip the first two lowest zoom levels so the user can't zoom in too far, then you'd still set numZoomLevels to 8, but you'd set zoomOffset to 10 (20, minus 8, minus 2) and set the map view resolutions to match the 8 zoom levels (skipping the two lowest resolutions).

Alternate tile subset example
<view id='com.cohga.html.client.map.mapView'>
	<mapEngine id="mapengine.tiled">
		<options>
			<numZoomLevels>8</numZoomLevels>
			<zoomOffset>10</zoomOffset>
		</options>
	</mapEngine>
	<mapEngine id="mapengine.vector"/>
	<mapEngine id="mapengine.selection">
		<options>
			<selection>true</selection>
		</options>
	</mapEngine>
	<!-- resolutions should match tiled map engine -->
	<resolutions>152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627</resolutions>
	<!-- CRS should match tiled map engine -->
	<crs>EPSG:3857</crs>
</view>

Server Resolutions

It is now possible to specify the resolutions provided by the tiles separately from those used by the client, and then have Weave choose the closest.

Note:

  • This will cause the displayed tiles to not look as crisp as they would if the correct resolutions are used.
  • The tiles must still be in the same projection as the client.

serverResolutions example
<view id='com.cohga.html.client.map.mapView'> 
	<mapEngine id="mapengine.tiled">
		<options>
			<serverResolutions>160000,80000,40000,20000,...full list missing for brevity...,0.5</serverResolutions>
		</options>
	<mapEngine id="mapengine.vector"/>
	<mapEngine id="mapengine.selection">
		<options>
			<selection>true</selection>
		</options>
	</mapEngine>
	<resolutions>156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,...full list missing for brevity...,0.5971642833948135</resolutions>
	<!-- CRS should match tiled map engine -->
	<crs>EPSG:3857</crs>
</view>


Google Maps Tiles

Full list of Google Maps Tile resolutions is:

156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135, 0.29858214169740677, 0.14929107084870338, 0.07464553542435169, 0.037322767712175846, 0.018661383856087923, 0.009330691928043961, 0.004665345964021981, 0.0023326729820109904, 0.0011663364910054952 



  • No labels