I wonder if it's posible export from insaid ol.layer.Vector value source: 
and style: as variable?

I would like create automatic set of layers. I have array of source name 
(url_wfs) and array of style name (style_wfs). 
How to create vector layer when style value is deliver as variable?


var url_wfs = ['v_1','v_2'], style_wfs = [s_1','s_2'];
  
var vectorSource = new ol.source.Vector({
    format: new ol.format.GeoJSON(),
    url: function(extent, resolution, projection) {
      return 'http://xxxx/xxx?service=WFS&;' +
        'version=1.1.0&request=GetFeature&typename=ant_mapy:'+ *wfs_v *+'&' 
+
        'outputFormat=application/json&srsname=EPSG:3857&' +
        'bbox=' + extent.join(',') + ',EPSG:3857';
    },
    strategy: ol.loadingstrategy.box
  });


for(var i = 0; i < url_wfs.length; i++) {
  *wfs_v* = url_wfs[i]; 
*   wfs_s* = style_wfs[i]; 

 var v_rfid = new ol.layer.Vector({
 source: vectorSource,
 style: *wfs_s*,
 title: 'RFID ' + i,
 description: 'some description'
  });
}

Maybe is another possibility create automatic set of layers?

-- 
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 
https://groups.google.com/d/msgid/ol3-dev/f9da5bd2-2d0c-4029-86f6-fa3630e32624%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to