Sure this can be done. Use vectors, not markers. Markers are deprecated and will drive you nuts with bugs.<div><br></div><div>With vectors you create a &quot;style&quot; and set the externalGraphic to the URL of the image you want. Something like this (this is totally untested, so mess around with it):</div>
<div><br></div><div>style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style[&#39;default&#39;]);</div><div>style.externalGraphic=&quot;<a href="http://domain.com/yourimage.png">http://domain.com/yourimage.png</a>&quot;</div>
<div><div>style.graphicWidth=62</div><div>style.graphicHeight=38</div><div><br></div><div>vectorPoint=new OpenLayers.Geometry.Point(-76.269, 36.8741);</div><div><br></div><div>vector = new OpenLayers.Feature.Vector(vectorPoint,null,style);</div>
<div><br></div><div>vectorLayer.addFeatures([vector]);</div><div><br></div><div><br></div><div>Anyway, that&#39;s the vector part, the canvas part may be a little trickier, because you need to ultimately create a URL.</div>
<div><br></div><div>Maybe what you could do is base64 the canvas image, then use that as your url. Or if you use html5 file writer, you could write it locally in the browser. You&#39;ve probably already seen this, but you can base64 the image and use it like a url, like this:</div>
<div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:16px;background-color:rgb(255,255,255)">&lt;img src=&quot;data:image/png;</span><em style="font-weight:bold;font-style:normal;font-family:arial,sans-serif;line-height:16px;background-color:rgb(255,255,255)">base64</em><span style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:16px;background-color:rgb(255,255,255)">,iVBORw0KGgoAAAANS</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:16px;background-color:rgb(255,255,255)">iVBORw0KGgoAAAANS&quot;&gt;</span></div>
<div><br></div><div>Did that help?</div><div><br></div><div>Steve</div><br><div class="gmail_quote">On Sat, Apr 21, 2012 at 11:28 PM, alexe100 <span dir="ltr">&lt;<a href="mailto:imoveisnacionais@gmail.com">imoveisnacionais@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
I would like to set an icon to a marker with specific information, for<br>
example the veicle plate and not the same icon for all the markers.<br>
<br>
Is it possible to create an icon on the fly using a canvas or something and<br>
set that icon or image to a specific marker?<br>
<br>
Like this: imagine a map with 10 markers (veicles). All the markers are<br>
resoresented by the same global image/icon but bellow the icon or image<br>
there is allways present the veicle plate.<br>
<br>
<br>
<br>
Thanks a lot<br>
<br>
<br>
Alex<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/marker-using-a-on-the-fly-created-icon-tp4906613p4906613.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/marker-using-a-on-the-fly-created-icon-tp4906613p4906613.html</a><br>

Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</font></blockquote></div><br></div>