Category: Web Map Service

Beware of decimal pixel values in OpenLayers.

Posted by – Wednesday 2012-12-19

So you are programming an OpenLayers based map viewer and attempt to make a WMS GetFeatureInfo request. The response will later be pretty-formatted and displayed to the user. In order to to accomplish this you create JavaScript code like the shown below:

var parameters = {
    srs: map.getProjection(),
    bbox: map.getExtent().toBBOX(6),
    width: map.getSize().w,
    height: map.getSize().h,
    x: evt.xy.x,
    y: evt.xy.y,
    layers: 'municipalities',
    query_layers: 'municipalities'
};

OpenLayers.Request.issue({
    method: 'get',
    url: this.getFeatureInfoUrl,
    async: false,
    params: parameters,
    success: function(data) {
       var responseText = data.responseText;
       // ...
    }
});

where evt (lines 6 and 7) represents the mouse click event that triggered the GetFeatureInfo request.

More…

Disabling GeoServer disk quotas.

Posted by – Tuesday 2012-10-23

On some installations, GeoServer will not start because an issue with GeoWebCache’s diskquotas.

GeoWebCache is a component bundled with GeoServer that offers Time Map Service and Web Map Tile Service. Since these services might demand big amounts of disk storage, disk quotas are used to limit the consumed storage [1, 2]. Thus, other services will not stop working because a lack of available storage.

More…

GeoServer SQL views.

Posted by – Monday 2012-08-20

In this post we will see a simple example of how GeoServer’s SQL views [note 1] can be used to derive multiple layers from a single SQL table.

1. The arena.

I had a table in a PostGIS database that stores the geometries of all roads in the province of Lugo. Each road has a geometry and a set of attributes. One of these attributes is ‘owner’, which stores the road owner: a municipality, a province, a regional government or the central government.

From this table I needed to generate four WMS layers: roads owned by municipalities, roads owned by the the province, and so on.

More…

Annotation layers in GeoServer.

Posted by – Saturday 2012-07-21

Currently I am working in a project that requires switching from MapServer to GeoServer. As a newcomer to the latter, one of the things I miss is MapServer’s annotation layers. An annotation layer is one that just shows labels, like names of towns or countries. In this post we will see how annotation layers can be implemented using GeoServer.

1. The arena.

In our example there is already an existing WMS layer named ‘municipalities’, that contains the borders of some municipalities of Galicia and whose geometry type is multipolygon. The data source is a shapefile. The following screenshot – taken from GeoServer’s administration application – shows the attributes the municipalities have.

GeoServer screenshot

Our goal is showing the municipalities names in a different WMS layer, so an user of the WMS service can toggle the visibility of this annotation layer, that is, being able to show or hide, in every moment, the municipalities’ names. The names of the municipalities are stored in the attribute ‘NOMBRE’.

More…

Custom legend icons in MapServer.

Posted by – Thursday 2012-07-05

As seen in a recent post in this blog, MapServer implements the optional WMS request GetLegendGraphic.

You can find that the generated icons do not fit your needs, and prefer that MapServer returns custom legend icons provided by you. Let’s see how can it be accomplished.

First, is convenient that in your LEGEND object you supply the icons size; in our example, it will be 20×20 pixels.

LEGEND
    ...
    KEYSIZE 20 20
END # end of legend object

More…