Alexandre,<br><br>thanks for your thoughts. Although if I understand what you're saying and the example correctly, this will not make the markers to pop up with bubbles where I can put text.<br><br>I am currently placing markers with text on them where if you click on the marker a little bubble will appear.<br>
<br>Here's another snippet that I forgot to include:<br><br> var click = new OpenLayers.Control.Click();<br> map.addControl(click);<br> click.activate();<br> var new2 = new OpenLayers.Layer.Text( 'Texts', { layerToUse: markers, newLat: '4188741.7304207', newLon: '217101.58694106', newTitle: "Title1", newDesc: "Desc1", idUser : '62', userName: 'admin', newIcon: 'images/markers/marker.png'} );<br>
new2.parseData();<br> var new3 = new OpenLayers.Layer.Text( 'Texts', { layerToUse: markers, newLat: '4182021.7304207', newLon: '210801.58694106', newTitle: "Title2", newDesc: "Desc2", idUser : '62', userName: 'admin', newIcon: 'images/markers/marker-blue.png'} );<br>
new3.parseData();<br> var new4 = new OpenLayers.Layer.Text( 'Texts', { layerToUse: markers, newLat: '4179441.7304207', newLon: '219681.58694106', newTitle: "Title3", newDesc: "Desc3", idUser : '62', userName: 'admin', newIcon: 'images/markers/marker.png'} );<br>
new4.parseData();<br>I am not quite sure what that click function does, could it be the culprit? <br><br>I have used this example as a base: <a href="http://dev.openlayers.org/releases/OpenLayers-2.8/examples/markers.html">http://dev.openlayers.org/releases/OpenLayers-2.8/examples/markers.html</a><br>
The thing is I use a form also to create new bubbles where users can enter a title, marker icon and description and get a result similar to the above.<br><br>Thanks again,<br><br>Alex<br><br><div class="gmail_quote">On Thu, Feb 4, 2010 at 3:34 PM, Alexandre Dube <span dir="ltr"><<a href="mailto:adube@mapgears.com">adube@mapgears.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Alex,<br>
<br>
I just looked at the SelectFeature control code and I think you could try this solution :<br>
<br>
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 :<br>
<br>
var select = new OpenLayers.Control.SelectFeature([vectors, markers], options);<br>
<br>
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.<br>
<br>
Hope this helps,<br>
<br>
Alexandre<br>
<br>
[1] <a href="http://openlayers.org/dev/examples/styles-unique.html" target="_blank">http://openlayers.org/dev/examples/styles-unique.html</a><br>
<br>
<br>
Alex G. wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
Hi all,<br>
<br>
I am probably having a conflict problem with some of my layers. I currently have 3 layers active on my installation:<br>
- a layer containing the data from a shapefile (running WMS)<br>
- a vector layer where users can draw<br>
- a layer dedicated to markers.<br>
<br>
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.<br>
<br>
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.<br>
<br>
map = new OpenLayers.Map('map',{maxExtent: new OpenLayers.Bounds(195441.084706006,4171163.51662705,240142.089176109,4203199.94421431), maxResolution: 120, units: 'dd'});<br></div>
layer = new OpenLayers.Layer.WMS( 'Landmass ', '<a href="http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&" target="_blank">http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&</a> <<a href="http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&" target="_blank">http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&</a>>', <br>
<div class="im">
{<br>
layers: 'zak',<br>
format:'PNG',<br>
bbox: '195441.084706006,4171163.51662705,240142.089176109,4203199.94421431',<br>
srs: 'EPSG:4326'<br>
});<br>
lakegr_wms = new OpenLayers.Layer.WMS( 'Lakes',<br></div>
'<a href="http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&" target="_blank">http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&</a> <<a href="http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&" target="_blank">http://localhost:8585/cgi-bin/mapserv?map=/opt/fgs/apps/gmap-demo-cvs_MS_VERSION_54/htdocs/gmap75a.map&</a>>',<div>
<div></div><div class="h5"><br>
{<br>
layers: 'sedi',<br>
transparent: 'true',<br>
format: 'image/png'<br>
},<br>
{isBaseLayer: false}<br>
);<br>
vectors = new OpenLayers.Layer.Vector( 'Editable' );<br>
vectors.onFeatureInsert=function(feature) {<br>
var wkt=wktwriter.write(feature);<br>
console.log(wkt);<br>
}<br>
map.addLayer(layer);<br>
map.addLayers([lakegr_wms,vectors]);<br>
map.addControl(new OpenLayers.Control.LayerSwitcher());<br>
controls = {<br>
point: new OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Point),<br>
line: new OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Path),<br>
polygon: new OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Polygon),<br>
drag: new OpenLayers.Control.DragFeature(vectors)<br>
};<br>
<br>
for(var key in controls) {<br>
map.addControl(controls[key]);<br>
}<br>
<br>
map.zoomTo(1);<br>
var options = {<br>
hover: true,<br>
highlightOnly: true<br>
};<br>
var select = new OpenLayers.Control.SelectFeature(vectors, options);<br>
selectCtrl = new OpenLayers.Control.SelectFeature(vectors,<br>
{<br>
clickout: true,<br>
onSelect: serialize<br>
}<br>
);<br>
map.addControl(select);<br>
map.addControl(selectCtrl);<br>
select.activate();<br>
selectCtrl.activate();<br></div></div>
*<br>
* Inherits from:<div class="im"><br>
var markers = new OpenLayers.Layer.Markers( 'Markers' );<br>
map.addLayer(markers);<br>
<br>
Rest of the code is taken from the markers example on OpenLayers.<br>
<br>
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.<br>
<br>
Thanks in advance.<br>
<br></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@openlayers.org" target="_blank">Dev@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
<br>
</blockquote>
<br>
<br>
-- <br>
Alexandre Dubé<br>
Mapgears<br>
<a href="http://www.mapgears.com" target="_blank">www.mapgears.com</a><br>
<br>
</blockquote></div><br>