openlayersgeoserverwps

Return features within a circle/polygon


I am new to Openlayers and not sure if this question falls in scope of Openlayers or Geoserver. I am showing some poi data in the form of layers on my map.

The requirement is that a user can draw a circle or a polygon anywhere on the map and I have to pull out all the POIs within this region.

I am not sure how it can be implemented. I am using createRegularPolygon to create circle or polygon, but not sure how it can fetch the features within a circle. Any inputs?


Solution

  • You need to use a WPS (Web Processing Service) for this. It is available in Geoserver and there is even a Request Builder in Geoserver, see here:

    Geoserver WPS Request Builder

    Here is a related question, which I think does the same thing you want to do:

    gis.stackexchange.com - Displaying Feature Info for a user defined polygon

    You should post all GIS related questions there as there are more people who know answers to GIS questions.