I have a vector-point shapefile. The data are not dense (about 1 x 1 degree). Lets say that every point includes value of average wind speed.

I would like to create a interactive web-map so that every time a user click on it, he/she get information about the point of interest (POI).

enter image description here This map includes 3 layers

  1. bluemarble base layer
  2. WMS layer of points with data
  3. TIFF layer created from wind speed data (red - high, blue - low)

I have two problems. 1) to many points clicked

when the map is zoomed-out it happens that user's click covers more then 1 point of the vector so that GetFeatureInfo returns too much info.

In the event.text I got info of the TIFF raster clicked pixel, GREEN, RED, BLUE, ALPHA_BAND and values of all the clicked points:

  <th >long</th>
  <th >lat</th>
  <th >codetec</th>
  <th >modelno</th>
  <th >tecdiff</th>

  <tr class="odd">
  <tr class="odd">

and some more, but you got the point.

2) no point clicked when zoomed-in

When it is zoomed-in too much the user obviously does not click any point of the vector layer. So there is no info about the vector layer only the TIFF raster colour band info.

I would say that the 1) problem can be solved by formatting the GetFeatureInfo response but I am lost in the problem 2).

Is there a way how to force to get info from the nearest point? Or show info always from one point only? Should I change the vector layer? I tried to use create Voronoi polygons but I did not succeed to produce any layer (and there two links : Q1 and Q2 suggest that that does not work that well in QGIS anyway). Is it possible to retrieve the value from the raster colour band?

2 Answers 2


It sounds like your workflow would function better with a seamless grid of polygons instead of points. That way there would be no empty space when a user clicked on the map. Maybe try creating a vector grid and joining you point attributes to it?

  • Thx! That was exactly what I needed. It took me some time to figure everything out but the problem is solved. I will make my own answer to provide complete solution for anyone with the same issue.
    – MasterPJ
    Mar 6, 2014 at 15:21

This is the complementary info to mpianka answer:

creating a vector grid and joining you point attributes

Thanks a lot.

problem 2) to many points clicked

Creating a vector from data point in QGIS is done by the menu Vector > Research Tools > Vector Grid. I used polygon output as suggested. Please be aware of the issue of hanaging. To avoid that, use appropriate X, Y parameters. If you set them to small, it will take a lot of time and space to create the output which you do not even need or the QGIS will hang.

So basicly you want to have one polygon for each grid point. enter image description here

Now you have to connect the data of the points to polygons. Very nice tutorial can be found here. Both polygons and points have to have some similar attribute according to which you will connect the data. I used ID as both vectors data were counted from top left corner.

problem 1) to many points clicked

WMSGetFeatureInfo has a parameter maxFeatures which can do the jop. Simply put the layer from which you want the data as the first (allinfo in my case):

 var allinfo = new OpenLayers.Layer.WMS("All info layer",  
    layers: "allpolydata",
    transparent: true,
    visibility: false,
    isBaseLayer: false,
    singleTile: true 


var mapPanel = new GeoExt.MapPanel({
    title: "Map",
    renderTo: "container",
    width: 650, height: 356,
    map: map,
    center: [0, 0],
    zoom: 2

map.addControl(new OpenLayers.Control.LayerSwitcher()); 

var control2 = new OpenLayers.Control.WMSGetFeatureInfo({
        url: 'http://myWMSserver', 
        title: 'Identify features by clicking',
        eventListeners: {
            getfeatureinfo: function(event) {
            var loc = mapPanel.map.getLonLatFromViewPortPx(event.xy);
            var txt = event.text;

Like this I got feature from one layer only and from one point only regardless the map zooming.

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.