Hello there,

Beforehand, the group description says:
Welcome to the OpenLayers 3 development discussions group. Thanks for your 
interest, and we look forward to any contributions you can make. THIS GROUP 
IS FOR CONTRIBUTORS. If you are a user of OpenLayers 3 and want to ask 
usage questions, please go to 
http://stackoverflow.com/questions/tagged/openlayers-3 and use the 
openlayers-3 tag for new questions.

Anyways, your answer is; you are not able to get multiple features selected 
using drag box. At least from your codes, it seems you directly get all the 
features from the layer source. Your codes should be like:

// a DragBox interaction used to select features by drawing boxes
var dragBox = new ol.interaction.DragBox({
  condition: ol.events.condition.shiftKeyOnly,
  style: new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: [0, 0, 255, 1]


dragBox.on('boxend', function(e) {
  var selectedFeatures = [];
  var extent = dragBox.getGeometry().getExtent();
  vectorSource.forEachFeatureIntersectingExtent(extent, function(feature) {
  //here selectedFeatures array is filled with selected features intersecting 
your drag box.



18 Eylül 2016 Pazar 09:51:49 UTC+3 tarihinde Hamadtou Hassan yazdı:
> I am able to to get the multiple features selected using drag box,  How 
> can I loop through these selected features and get their attribute to show 
> in Html Table.
> the following loop  show  all the attribute of the WFS instead of the 
> selected features.
> //  this loop show all the attribute instead of selected features 
> attribute.
>             var features = serverVector.getSource().getFeatures(); 
> //serverVector.getSource().getFeatures();
>             for (i = 0; i < features.length; i++) {
>                 content += "<tr><td >" + features[i].get('PROP_ID') + 
> "</td><td>" + features[i].get('file_as_na') + "</td><td>" + features[i].
> get('addr_line2') + " </td></tr>";
>             }

You received this message because you are subscribed to the Google Groups "OL3 
Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ol3-dev+unsubscr...@googlegroups.com.
To post to this group, send email to ol3-dev@googlegroups.com.
Visit this group at https://groups.google.com/group/ol3-dev.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to