I need to select from a layer(s) and I am wondering what way I should serve the layer.

The requirements are that I need to be able to select multiple features at a time by drawing a box or polygon. They should become highlighted and I should display the data for all the features. I don't need to do any editing of them.

I'm using geoserver and openlayers

  • Were you able to execute this application? I wanted to know how can it be implemented?
    – Sam007
    Commented Jun 7, 2012 at 21:17
  • For the selecting you describe, only WFS is possible. For WMS you can select at a point location, or you can select by some known attribute/attributes and resymbolize using SLD.
    – nmtoken
    Commented Feb 5, 2020 at 18:12

2 Answers 2


It sounds like you want to store the vectors in the browser, and query them client side. To do that, you'll need to use WFS.

One caveat, though, is that browsers have limitations on how many vectors they can display at one time. If you're dealing with large or complicated data sets, it may be that your only option will be to use WMS. That would be more complicated to implement, though, because the queries would then have to be done server side.

  • 7
    actually OpenLayers has no limit on the number of features it can display, browsers have limits on the number of features they can display.
    – Ian Turton
    Commented Jul 28, 2011 at 8:43
  • 2
    The maximum number of features will not only depend on the web browser, but also on the client computer features like the processor or RAM memory. Given that, you, the developer, do not know what client computer will run 'your' OpenLayers based map viewer, being conservative when estimating this limit is advisable.
    – dariapra
    Commented Jul 28, 2011 at 9:53
  • 1
    I'm thinking WMS would serve his purpose quiet nicely. Keep the complicated processing at the server side (if possible), and result rendering at the client side. You'll have better performance, and you can still use scripted filters like Intersections, Contains, Within etc. Have a look at geoserver. Commented Jul 28, 2011 at 19:55
  • 2
    I'd suggest you commit to either paradigm. 1. Client Retrieves the data and processes/queries it accordingly, server only serves data (WFS). 2. Client takes care of rendering only, server performs processing/query tasks and delivers the result (WMS). Both have pro's and con's, but do not muddy the process and download the data (WFS) and get the server to also do the processing/queries. This creates unnecessary overhead and complicates the situation Commented Jul 28, 2011 at 19:59
  • @iant: I understand that openlayers doesn't have a limit on the number of features it can display. I think we can both agree that it has limitations, though ;)
    – canisrufus
    Commented Jul 28, 2011 at 19:59

If you are already have visual data such as a basemap and just need to select features the WFS would work very well for that. Although, if you need a visual component to go along with your selection, you would be better served by a WMS service, since it was created for that.

Although hearing your use-case as you described it, I would personally would just use a WMS service.

Also, the GeoServer Blog as a great write-up on the two services and when you should should leverage them.

Edit: On an additional note if you are doing anything other than simply querying the feature data, I as a general rule just use WFS, it excels when it comes to data manipulation in comparison to the other OGC services I have used lately. Also, take that with a grain of salt, that is just what I had experienced in my use of the services, which is why I have attached the preceding and following links.

OGC Standards:

  • +1 for the link about when to leverage the service types. Commented Jul 28, 2011 at 20:00
  • I think there is a typo. Your second occurrence of "WFS" seems like it should read "WMS".
    – canisrufus
    Commented Jul 28, 2011 at 20:17
  • Thanks, what happened was that I had edited to fix sentence flow, and then I believe that I had accidentally changed what I had originally meant to say.
    – dkroy
    Commented Jul 29, 2011 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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