Alexandre,<br><br>thanks again for your valuable help!<br><br>At the moment the best idea would be to have vector points as markers, which would make them both clickable and perfect for what I need to do.<br><br>I have added this info to the vector layer:<br>
<br> vectors = new OpenLayers.Layer.Vector('Vectors', {<br> styleMap: new OpenLayers.StyleMap({<br> externalGraphic: "images/markers/marker-gold.png",<br> pointRadius: 10<br>
})<br> });<br><br>And the point appears correctly with the marker icon. But I have run into 2 problems now:<br><br>1) All my polygons and lines appear black or invisible<br>2) I would like to use more than one image for the markers<br>
<br>My controls looks like this:<br><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>
select: selectControl<br> };<br><br>Is there a way to maybe pass the external image specifically to the "point" control?<br><br>I am unsure about the syntax and I wasn't able to find any info around, maybe something like this: <br>
<br>point: new OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Point, {style: blah blah}),<br><br>If it's possible, then that solves my 2nd problem as well for different images.<br><br>Thanks in advance!<br><br>Best regards,<br><br>
Alex<br><br><div class="gmail_quote">On Thu, Feb 4, 2010 at 8:26 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>
Take a look at this example [1]. Vector features can be used with a SelectFeature control to open popups. You only need to define the externalGraphic to have images and define the geometry type to "point". See an other example of "draw" types.<br>
<br>
You might be interested to take a look at this example [3] too (it's a development sandbox for a RedLining widget in GeoExt). It uses a lot of OpenLayers components to draw/select the features. Maybe that can helps too.<br>
<br>
Kind regards,<br>
<br>
Alexandre<br>
<br>
[1] <a href="http://openlayers.org/dev/examples/select-feature-openpopup.html" target="_blank">http://openlayers.org/dev/examples/select-feature-openpopup.html</a><br>
[2] <a href="http://openlayers.org/dev/examples/draw-feature.html" target="_blank">http://openlayers.org/dev/examples/draw-feature.html</a><br>
[3] <a href="http://dev.geoext.org/sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html" target="_blank">http://dev.geoext.org/sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.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">
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" target="_blank">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><div><div></div><div class="h5">
On Thu, Feb 4, 2010 at 3:34 PM, Alexandre Dube <<a href="mailto:adube@mapgears.com" target="_blank">adube@mapgears.com</a> <mailto:<a href="mailto:adube@mapgears.com" target="_blank">adube@mapgears.com</a>>> wrote:<br>
<br>
Alex,<br>
<br>
I just looked at the SelectFeature control code and I think you<br>
could try this solution :<br>
<br>
Change you Marker layer for a Vector one (you can define<br>
externalGraphic to a vector feature, see an example [1]) and then<br>
configure your SelectFeature control with both your layers :<br>
<br>
var select = new OpenLayers.Control.SelectFeature([vectors,<br>
markers], options);<br>
<br>
The SelectFeature control will create a RootContainer layer<br>
object enabling selection on both at the same time, thus fixing<br>
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>
<br>
Hi all,<br>
<br>
I am probably having a conflict problem with some of my<br>
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<br>
with it afterwards unless I hide the vectors layer. The order<br>
is correct, I load first the shp layer, then the vector one<br>
and then the markers one.<br>
<br>
I include here some of my code in hope that it will help, it's<br>
mostly from examples on openlayers so there's really nothing new.<br>
<br>
map = new OpenLayers.Map('map',{maxExtent: new<br>
OpenLayers.Bounds(195441.084706006,4171163.51662705,240142.089176109,4203199.94421431),<br>
maxResolution: 120, units: 'dd'});<br>
layer = new OpenLayers.Layer.WMS( 'Landmass ',<br>
'<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>
<<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>
<<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>
<<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>
<br>
{<br>
layers: 'zak',<br>
format:'PNG',<br>
bbox:<br>
'195441.084706006,4171163.51662705,240142.089176109,4203199.94421431',<br>
srs: 'EPSG:4326'<br>
});<br>
lakegr_wms = new OpenLayers.Layer.WMS( 'Lakes',<br>
'<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>
<<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>
<<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>
<<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>
<br>
<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<br>
OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Point),<br>
line: new<br>
OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Path),<br>
polygon: new<br>
OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.Polygon),<br>
drag: new<br>
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<br>
OpenLayers.Control.SelectFeature(vectors, options);<br>
selectCtrl = new<br>
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>
*<br>
* Inherits from:<br>
<br>
var markers = new OpenLayers.Layer.Markers(<br>
'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<br>
thinking it has something to do with clicks and some of the<br>
controls I use might be conflicting although I can't see any<br>
Javascript errors.<br>
<br>
Thanks in advance.<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Dev mailing list<br></div></div>
<a href="mailto:Dev@openlayers.org" target="_blank">Dev@openlayers.org</a> <mailto:<a href="mailto:Dev@openlayers.org" target="_blank">Dev@openlayers.org</a>><div class="im"><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
<br>
<br>
<br>
-- Alexandre Dubé<br>
Mapgears<br></div>
<a href="http://www.mapgears.com" target="_blank">www.mapgears.com</a> <<a href="http://www.mapgears.com" target="_blank">http://www.mapgears.com</a>><br>
<br>
<br>
</blockquote><div><div></div><div class="h5">
<br>
<br>
-- <br>
Alexandre Dubé<br>
Mapgears<br>
<a href="http://www.mapgears.com" target="_blank">www.mapgears.com</a><br>
<br>
</div></div></blockquote></div><br>