Vector layer over wms layer

0 views
Skip to first unread message

BryGom

unread,
Oct 15, 2014, 11:08:00 PM10/15/14
to ol3...@googlegroups.com
Hi, I'm trying to draw a line over a wms layer,  to do this, i use a vector layer. My problem is that the vector layer always appears below the wms layer. 

There is a way to let the vector layer provided on any other layer? 

Thank you for your help.

Thomas Gratier

unread,
Oct 15, 2014, 11:28:10 PM10/15/14
to OL3 Dev on behalf of BryGom
Hi,

Just change the order of your vector layer. For info, the last layer added is the one on the top of the others.

Cheers

Thomas Gratier

--
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+u...@googlegroups.com.
To post to this group, send email to ol3...@googlegroups.com.
Visit this group at http://groups.google.com/group/ol3-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ol3-dev/c3b4c714-7571-4035-b5a6-bb110f1989d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

BryGom

unread,
Oct 16, 2014, 12:14:51 AM10/16/14
to ol3...@googlegroups.com
Thank your for your answer.

I have this code:

var measureSource = new ol.source.Vector();
  var lMeasure = new ol.layer.Vector({
  source: measureSource,
  style: new ol.style.Style({
    fill: new ol.style.Fill({
      color: 'rgba(255, 255, 255, 0.2)'
    }),
    stroke: new ol.style.Stroke({
      color: '#ffcc33',
      width: 2
    }),
    image: new ol.style.Circle({
      radius: 7,
      fill: new ol.style.Fill({
        color: '#ffcc33'
      })
    })
  })
});


layers[0] = new ol.layer.Group({ layers: [ new ol.layer.Tile({ source: new ol.source.MapQuest({layer: 'sat'}) }), new ol.layer.Tile({ source: new ol.source.MapQuest({layer: 'hyb'}) }) ] });
layers[1] = new ol.layer.Tile({ source: new ol.source.MapQuest({layer: 'osm'}) });
layers[2] = new ol.layer.Tile({ source: new ol.source.OSM() });
layers[3] = lMeasure;
map = new ol.Map({
        target: 'map',
        controls: ol.control.defaults().extend([ new ol.control.ScaleLine({ units:'metric' }) ]).extend([mousePositionControl]),
        layers: layers,
        view: view
      });

But, the vector layer always appears below.



El miércoles, 15 de octubre de 2014 21:28:10 UTC-6, ThomasG77 escribió:
Hi,

Just change the order of your vector layer. For info, the last layer added is the one on the top of the others.

Cheers

Thomas Gratier
Reply all
Reply to author
Forward
0 new messages