Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Custom Control

Hold Shift button to create the rectangle

http://openlayers.org/dev/examples/custom-control.html

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

http://openlayers.org/dev/examples/dynamic-text-layer.html

Get WFS from Geoserver (Web Feature Service)

This get the WFS service from Geoserver and displays in Openlayers

http://openlayers.org/dev/examples/getfeature-wfs.html

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.

share|improve this answer
    
Thanks @Mapperz this is just what I needed –  Sam007 Jun 7 '12 at 22:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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