Alex, I just looked at the SelectFeature control code and I think you could try this solution :
Change you Marker layer for a Vector one (you can define externalGraphic to a vector feature, see an example [1]) and then configure your SelectFeature control with both your layers : var select = new OpenLayers.Control.SelectFeature([vectors, markers], options); The SelectFeature control will create a RootContainer layer object enabling selection on both at the same time, thus fixing your issue. Please, tell me if that worked. Hope this helps, Alexandre [1] http://openlayers.org/dev/examples/styles-unique.html Alex G. wrote: > Hi all, > > I am probably having a conflict problem with some of my layers. I > currently have 3 layers active on my installation: > - a layer containing the data from a shapefile (running WMS) > - a vector layer where users can draw > - a layer dedicated to markers. > > I have noticed that if I place a marker, I cannot interact with it > afterwards unless I hide the vectors layer. The order is correct, I > load first the shp layer, then the vector one and then the markers one. > > I include here some of my code in hope that it will help, it's mostly > from examples on openlayers so there's really nothing new. > > map = new OpenLayers.Map('map',{maxExtent: new > OpenLayers.Bounds(195441.084706006,4171163.51662705,240142.089176109,4203199.94421431), > > maxResolution: 120, units: 'dd'}); > layer = new OpenLayers.Layer.WMS( 'Landmass ', > 'http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map& > > <http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&>', > > > { > layers: 'zak', > format:'PNG', > bbox: > '195441.084706006,4171163.51662705,240142.089176109,4203199.94421431', > srs: 'EPSG:4326' > }); > lakegr_wms = new OpenLayers.Layer.WMS( 'Lakes', > > 'http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map& > > <http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&>', > { > layers: 'sedi', > transparent: 'true', > format: 'image/png' > }, > {isBaseLayer: false} > ); > vectors = new OpenLayers.Layer.Vector( 'Editable' ); > vectors.onFeatureInsert=function(feature) { > > var wkt=wktwriter.write(feature); > console.log(wkt); > } > map.addLayer(layer); > map.addLayers([lakegr_wms,vectors]); > map.addControl(new OpenLayers.Control.LayerSwitcher()); > controls = { > point: new OpenLayers.Control.DrawFeature(vectors, > OpenLayers.Handler.Point), > line: new OpenLayers.Control.DrawFeature(vectors, > OpenLayers.Handler.Path), > polygon: new OpenLayers.Control.DrawFeature(vectors, > OpenLayers.Handler.Polygon), > drag: new OpenLayers.Control.DragFeature(vectors) > }; > > for(var key in controls) { > map.addControl(controls[key]); > } > > > map.zoomTo(1); > var options = { > hover: true, > highlightOnly: true > }; > > var select = new OpenLayers.Control.SelectFeature(vectors, > options); > selectCtrl = new OpenLayers.Control.SelectFeature(vectors, > { > clickout: true, > onSelect: serialize > } > ); > map.addControl(select); > map.addControl(selectCtrl); > select.activate(); > selectCtrl.activate(); > * > * Inherits from: > var markers = new OpenLayers.Layer.Markers( 'Markers' ); > map.addLayer(markers); > > Rest of the code is taken from the markers example on OpenLayers. > > Can anyone think of any reason why they would conflict? I am thinking > it has something to do with clicks and some of the controls I use > might be conflicting although I can't see any Javascript errors. > > Thanks in advance. > > ------------------------------------------------------------------------ > > _______________________________________________ > Dev mailing list > Dev@openlayers.org > http://openlayers.org/mailman/listinfo/dev > -- Alexandre Dubé Mapgears www.mapgears.com _______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev