[OpenLayers-Dev] Markers and Vector Layer conflict
Alex G.
unseen.wizard at gmail.com
Thu Feb 4 07:43:05 EST 2010
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&',
{
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&
',
{
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();
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100204/01972a13/attachment.html
More information about the Dev
mailing list