<p>You have to configure your vector layer with the {rendererOptions: {zIndexing: true}} option to make this work. Note that this setting will make vector rendering significantly slower, so the advice to use separate layers is a good one.</p>
<p>Andreas.</p>
<div class="gmail_quote">On Oct 12, 2011 9:39 PM, "Jürgen Dankoweit" <<a href="mailto:Juergen.Dankoweit@t-online.de">Juergen.Dankoweit@t-online.de</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello to the list,<br>
<br>
In a map I want to show cities that have actual weather data in<br>
foreground and cities that do not have actual data behind the other cities.<br>
After long time of googling I don't know why zIndexing in my code does<br>
not work.<br>
<br>
Many thanks for the answers<br>
<br>
Juergen<br>
<br>
Here are the code snippets:<br>
<br>
var z_Index = (data_cnt == 10 ? 1000 : -1000);<br>
<br>
vectorLayer_Stadt = new OpenLayers.Layer.Vector("Stadt", {<br>
styleMap: styleMap_Stadt,<br>
renderers: renderer,<br>
rendererOptions: {<br>
zIndexing: true<br>
},<br>
displayInLayerSwitcher: false<br>
});<br>
<br>
<br>
First try:<br>
==========<br>
var styleMap_Stadt = new OpenLayers.StyleMap({'default':{<br>
label : "\${text}",<br>
fontColor: '\${fcolor}',<br>
fontSize: "14px",<br>
fontFamily: "Gentium",<br>
fontWeight: "bold",<br>
labelAlign: "cm",<br>
labelXOffset: 0,<br>
labelYOffset: 0,<br>
graphicZIndex: "${zIndex}"<br>
}});<br>
<br>
point = new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat);<br>
point.style = {<br>
graphicZIndex: z_Index<br>
};<br>
<br>
pointFeature_Stadt = new OpenLayers.Feature.Vector(point);<br>
pointFeature_Stadt.attributes =<br>
{text: stadt, fcolor: text_color};<br>
vectorLayer_Stadt.addFeatures([pointFeature_Stadt]);<br>
<br>
Result:<br>
=======<br>
No changes in the zOrder<br>
<br>
Second try:<br>
===========<br>
<br>
var styleMap_Stadt = new OpenLayers.StyleMap({'default':{<br>
label : "\${text}",<br>
fontColor: '\${fcolor}',<br>
fontSize: "14px",<br>
fontFamily: "Gentium",<br>
fontWeight: "bold",<br>
labelAlign: "cm",<br>
labelXOffset: 0,<br>
labelYOffset: 0,<br>
}});<br>
<br>
<br>
pointFeature_Stadt = new OpenLayers.Feature.Vector(point);<br>
pointFeature_Stadt.attributes =<br>
{text: stadt, fcolor: text_color, zIndex = z_Index};<br>
vectorLayer_Stadt.addFeatures([pointFeature_Stadt]);<br>
<br>
Result:<br>
=======<br>
No changes in the zOrder<br>
<br>
<br>
--<br>
Meine stets unfertige Homepage: <a href="http://www.dankoweit.de" target="_blank">www.dankoweit.de</a><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>
</blockquote></div>