2

I have issue with getFeatureInfo function. I can get features of polygon only if it is clicked on line (border) of polygon. By clicking on line, i get features of few polygons, and i want to click inside of polygon and get feature info of that polygon, nothing else. I'm using Openlayers 2.13 and GeoServer. Where can i fix this?

3

Perhaps you are running GeoServer 2.5 and you have faced a bug that happened if there was no fill defined for polygons. Bug was resolved in GeoServer 2.5.2. Read more details from http://osgeo-org.1560.x6.nabble.com/WMS-GetFeatureInfo-with-Polygon-td5163455.html.

First aid would be to add fill to the polygon style. Updating GeoServer should be a definitive fix but if you already run GeoServer 2.6 or 2.7 then it could mean that the bug has popped up again.

  • Same problem with GeoServer 2.11.1, solution was filling the Polygon.. # before hex code was the issue – mohsen hs Nov 7 '17 at 20:10
  • when you say about fill the polygon, we will do it using openlayer or on the geoserver ? – Thành Đào Ngọc Jun 1 '18 at 9:14
  • On GeoServer. The old buggy version thought that if polygon was not filled the was no feature to ask information from. – user30184 Jun 1 '18 at 9:26
1

I fixed problem by filling polygons with some color. Note: I'm running GeoServer 2.5.2 and bug is not fixed. But link above is very usefull, it helped me. Thanks to user30184.

0
       <sld:Fill>
          <sld:CssParameter name="fill">#F6F4DB</sld:CssParameter>
          <sld:CssParameter name="fill-opacity">0.20</sld:CssParameter>
        </sld:Fill>

Add value of fill-opacity 0.20 something like that

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.