Geomajas Community Documentation

Geomajas end user guide

Geomajas Developers and Geosparc

v1.8.0-SNAPSHOT


1. Introduction
2. Configuration
2.1. Dependencies
2.2. OpenStreetMap layer configuration

The OpenStreetMap layer allows you to display OpenStreetMap imagery as raster layer in Geomajas.


A complete OpenStreetMap layer configuration looks as follows:


The layer info inner bean has the same general content as usual, with one exception : the dataSourceName property is not necessary in this case. As with the WMS layer, the resolutions have been carefully chosen to match the tile server's resolutions. The tile width and height are implied by the server in this case but since they are required metadata for all raster layers, they should be set to the server's values: 256 x 256.

The default configuration for the server layer will use the Mapnik rendering of OpenStreetMap by round robin iteration over the following base URLs:

  • http://a.tile.openstreetmap.org

  • http://b.tile.openstreetmap.org

  • http://c.tile.openstreetmap.org

If you want to use a different list of base URLs to render e.g. Tiles@Home tiles, cycle map tiles or even custom tiles, you can specify a new set of base URLs in the server configuration:

<bean name="cyclemap" class="org.geomajas.layer.osm.OsmLayer" >
    <property name="layerInfo" ref="osmInfo" />
    <property name="baseUrls">
      <list>
        <value>http://a.tile.opencyclemap.org/cycle</value>
        <value>http://b.tile.opencyclemap.org/cycle</value>
        <value>http://c.tile.opencyclemap.org/cycle</value>
      </list>
   </property>
</bean>

It is even possible to configure your own tile builder strategy by setting the urlBuilder property of the server layer to a custom TileUrlBuilder implementation.