[OpenLayers-Users] Different icons for popups
bzrudi
bzrudi at centarea.com
Fri Jan 30 09:19:50 EST 2009
Hi list!
I have a strange problem with applying different icons to my
markers/popups using addUniqueValueRules(). I see all the examples and
read a lot but unfortunately it doesn't work as expected, so one may
help me out here please ;-)
So what I did. Defined a styleMap as below and bind my Vectorlayer to it.
var markerStyle = new OpenLayers.StyleMap({
externalGraphic: '../museum.png',
fillOpacity: 1,
pointRadius: 10,
});
vectorlayer = new OpenLayers.Layer.Vector('Infos',
{displayInLayerSwitcher: true,
styleMap: markerStyle});
This works as expected, all my markers have the "museum" icon instead of
the circle/point. I now tried to apply differnt icons to the
markers/popups using this as example:
var lookup = {
attraction: {externalGraphic: '../attraction.png', pointRadius: 15,
$js .= "vectorlayer = new OpenLayers.Layer.Vector('Polygon
Layer',
{displayInLayerSwitcher: true,
styleMap: markerStyle});\n";
fillOpacity: 1},
museum: {externalGraphic: '../museum.png'}, pointRadius: 15,
fillOpacity: 1},
}
and also add:
markerStyle.addUniqueValueRules("default", "attraction", lookup);
Now, instead of having all my markers using the "attraction" icon (what
is what I expected) - the markers are no longer displayed.
I tried lots of things to get rid of this but have no more idea how to.
Unfortunately I'm a PHP programmer with just basic JS knowledge. So if
there is anyone who can help, please let me know, thanks!
cheers bzrudi
More information about the Users
mailing list