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

Puneet Kishor punk.kish at gmail.com
Thu Nov 10 18:20:51 EST 2011


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


More information about the Users mailing list