I want to develop geoserver extension that intercepts wms request, checks specific url parameter, builds clusters of points and generate the response image with clusters.

I've studied a little the geoserver code. And I'm planning now to replace "FeatureLayer" in "mapContent" by my class. The class replaces real points by clusters of points.

The problem is I don't know how to inject my extension code into wms processing.

  • It's all here. Enjoy :D Failing that, it might be easier to do client side, say with OpenLayers clustering, and use Geoserver to generate based on WMS parameters you send. Commented Feb 17, 2015 at 12:19
  • Where is "here"? It's geoserver source. I see. Can you specify more exact? Client side clustering cannot be used with more than 600 points because of perfomance.
    – Belowee P.
    Commented Feb 17, 2015 at 13:27
  • 1
    In the folder called WMS. The point being, if you want to create a plugin for Geoserver, you will need to understand the source code. This is why I suggested doing this client side, using cluster strategy, and calling your wms with appropriate layers to build up the image you want. Commented Feb 17, 2015 at 13:29
  • I may have misunderstood your question, though. If you could explain a bit more what you are trying to do? Commented Feb 17, 2015 at 13:30
  • I want to build clusters of points like in a openlayers client and generate image of map with these clusters.
    – Belowee P.
    Commented Feb 18, 2015 at 9:00

1 Answer 1


You have eclipse workspace as it shown in Geoserver Developers Quick Start.

Create new java project. Create new class:

package org.geoserver.wms.cluster;

import org.geoserver.wms.GetMapCallback;
import org.geoserver.wms.GetMapCallbackAdapter;
import org.geoserver.wms.GetMapRequest;
import org.geoserver.wms.WMSMapContent;

public class ClusterGetMapCallbackAdapter extends GetMapCallbackAdapter
        implements GetMapCallback {

    public ClusterGetMapCallbackAdapter() {
    public GetMapRequest initRequest(GetMapRequest request) {       
        return request;
    public void initMapContent(WMSMapContent mapContent) {    
    public WMSMapContent beforeRender(WMSMapContent mapContent) {
        return mapContent;

Add file applicationContext.xml to META-INF directory:

<?xml version="1.0" encoding="UTF-8"?>
    <bean id="getMapCallback" class="org.geoserver.wms.cluster.ClusterGetMapCallbackAdapter">

Append new project to the dependencies of "gs-wms" project. Build solution. Set breakpoints at your code. Start geoserver. Create WMS layer. Browse to GetMap request. See breakpoints hitting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.