Table of Contents
This plug-in contains a raster layer definition for accessing raster data from TMS servers as specified by OSGeo. See the Specification. Although not an official OGC specification, TMS is easy to understand and has the advantage of high performance.
This plug-in does not support all TileMapService capabilities. It only supports a single TileMap configuration, represents a single layer. The supported TMS version is 1.0.0.
Table of Contents
This chapter describes the perils of configuring a TMS layer for your Geomajas application. There are 2 obstacles to conquer: getting the TMS plug-in jar on your class path, and configuring a TMS layer using the Geomajas configuration.
If you are using Maven, you're in luck. All you have to do is add the following dependency to your configuration:
<dependency> <groupId>org.geomajas.plugin</groupId> <artifactId>geomajas-layer-tms</artifactId> <version>1.0.0</version> </dependency>
If you are not a Maven user, make sure that there is a recent version of JaxB (2.x) on your class path. Normally the Geomajas server has already required this, but we're mentioning it just in case.
When configuring a TMS layer, there are 2 basic options to chose from: either configure your own RasterLayerInfo object (as with all other Geomajas raster layers), or you let the TMS plug-in configure the layer automatically, based upon the TMS layer description (see the TileMap resource in the TMS specification).
This option is the easiest one, but only works if your TMS actually has a TileMap description. If no such description is available, you need to configure a RasterLayerInfo yourself.
This options requires you to specify the TMS layer description
URL, upon which the TMS plug-in will retrieve the description and build
a RasterLayerInfo
automatically. The CRS, bounding box,
resolutions, etc will be taken from the TileMap description. Below is an
example of such a configuration:
<bean name="tms" class="org.geomajas.layer.tms.TmsLayer" > <property name="baseTmsUrl" value="http://tms.osgeo.org/1.0.0/landsat/" /> </bean>
This option would can be used in case there is no TMS description
available, or in case you wish to use different configuration options.
You would still need to specify the "baseTmsUrl" and a
RasterLayerInfo
object:
<bean name="tms" class="org.geomajas.layer.tms.TmsLayer" > <property name="baseTmsUrl" value="http://tms.osgeo.org/1.0.0/landsat/" /> <property name="extension" value="jpg" /> <property name="layerInfo" ref="layerTms" /> </bean> <bean name="layerTms" class="org.geomajas.configuration.RasterLayerInfo"> <property name="crs" value="EPSG:4326"/> <property name="maxExtent"> <bean class="org.geomajas.geometry.Bbox"> <property name="x" value="-180"/> <property name="y" value="-90"/> <property name="width" value="360"/> <property name="height" value="180"/> </bean> </property> <property name="resolutions"> <list> <value>0.5</value> <value>0.25</value> <value>0.125</value> <value>0.0625</value> <value>0.03125</value> <value>0.015625</value> <value>0.0078125</value> <value>0.00390625</value> <value>0.001953125</value> <value>0.0009765625</value> <value>0.00048828125</value> <value>0.000244140625</value> <value>0.000122070312</value> </list> </property> <property name="dataSourceName" value="landsat" /> <property name="tileWidth" value="512"/> <property name="tileHeight" value="512"/> </bean>
Note that this time, an extension and a link to a
RasterLayerInfo
have been added. The above configuration
will generate tiles like:
http://tms.osgeo.org/1.0.0/landsat/0/0/0.jpg