[OpenLayers-Users] points (vector) drawing under a layer instead of above it

Sveen Atle Frenvik (Geomatikk IKT) Atle.Frenvik.Sveen at geomatikk.no
Fri Nov 11 02:19:49 EST 2011


Because the layers are stacked in the order you add them. The first one 
at the bottom etc.. Try altering

map.addLayers([vector, wms]);

to

map.addLayers([wms,vector]);


-a


On 2011-11-11 00:20, Puneet Kishor wrote:
> I am drawing a WMS layer and a vector layer on top of a Google map base layer. The order is
>
> 	[vector, wms, google]
>
> I am drawing points on the vector layer, but the points are getting drawn under the wms layer. As a result, the points are not visible unless I go to the layer switcher and turn off the wms layer. Why are my points not being drawn on the top? Here is my code
>
> 	var gphy = new OpenLayers.Layer.Google(
> 		"Google Physical",
> 		{sphericalMercator: true, maxExtent: max_extent, type: google.maps.MapTypeId.TERRAIN}
> 	);
> 	
> 	map.addLayers([gphy]);
>
> 	map.setCenter(new OpenLayers.LonLat(lng, lat).transform(
> 		proj.latlng,
> 		map.getProjectionObject()
> 	), 7);
>
> 	var wms = new OpenLayers.Layer.WMS(
> 		"WMS layer",
> 		"http://server/cgi-bin/wms",
> 		{layers: "wms", transparent: true},
> 		{isBaseLayer: false, opacity: 1}
> 	);
> 	
> 	var vector = new OpenLayers.Layer.Vector("vector");
> 	vector.events.on({featureadded: foo});
>
> 	map.addLayers([vector, wms]);
>
> 	var feature_ctl = new OpenLayers.Control.DrawFeature(
> 		vector, OpenLayers.Handler.Point
> 	);
>
> 	map.addControl(feature_ctl);
> 	feature_ctl.activate();
>
> --
> Puneet Kishor_______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Atle Frenvik Sveen
Utvikler
Geomatikk IKT AS
tlf: 45 27 86 89
atle.frenvik.sveen at geomatikk.no


More information about the Users mailing list