0

I use GeoServer as my GIS service and render some points with pictures, SLD code like this:

<PointSymbolizer>
    <Graphic>
       <ExternalGraphic>
         <OnlineResource xlink:type="simple" xlink:href="http://xxx/xxx.jpg" />
         <Format>image/jpeg</Format>
       </ExternalGraphic>
       <Size>32</Size>
    </Graphic>
</PointSymbolizer>

and in OpenLayers all work fine, I can see picture is rendered normally.

But the problem is, when I want to click(select) this picture, it seems OpenLayers using WFS/WMS generated click bbox coordinates and send them to GeoServer, and if this bbox intersects with the Point(picture) coordinates, the point is selected only if I click very close to point coordinate. But when I click the edge of this picture or not very close to the point (still inside this picture), the click query bbox generated by OpenLayers do not intersect with picture rendering point and this feature will not be selected finally.

Simply said: there is a picture with 256*256 pixel size, rendered in GeoServer by PointSymbolizer.
This points coordinates are [128,128] (screen coordinate, center of picture).
When you click close to [128,128] this point can be selected, but when you click [250,250](still inside picture) this point can't be selected.

Any advice? thanks

1

Geoserver has a vendor specific (i.e. it is not present in the standards, but something specific to Geoserver) parameter called buffer for the WMS getFeatureInfo.

The documentation states that:

The buffer parameter specifies the number of additional border pixels that are used in the GetMap and GetFeatureInfo operations. The syntax is: buffer=<bufferwidth> where is the width of the buffer in pixels.

You can pass in a large buffer width if you wish. This might give wrong results when the points are close by.

  • thanks for reply,i will try it,but you are right,when features are closed to each other ,this buffer will be problem. – leicat Dec 5 '13 at 8:54
  • Recent Geoservers (2.4 and 2.5) have improved support for GetFeatureInfo (thanks to the Swedish city of Eskilstuna for sponsoring). The size of the symbol that is used for rendering should be understood now and your trouble should be solved. – user30184 May 20 '14 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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