Ok so I have a Openlayers App which is displaying few of the features and I now want to give the user the freedom to create a Box or polygon. All the features which are overlapped by this user defined box, I wish to export the data and then display it onto a table in the html.

  1. Is there any OL example to such application requirement?
  2. Which would be better to extract the feature info, WFS or WMS?

I know it can be done in GMaps but I have OSM and GMaps both as base maps so I require a OL functionality.


Custom Control

Hold Shift button to create the rectangle


You will get the bound box lat/lng response.

You can use this response to retrieve features.

Dynamic POIs via a Text Layer

In this example the data you see is retrieved from a text file but could be from a geojson,kml or database/api or geoserver


Get WFS from Geoserver (Web Feature Service)

This get the WFS service from Geoserver and displays in Openlayers


use the Shift key to add features to the selection,

You will want to combine the entire set of examples to do your 'select user defined polygon' map.


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.