[OpenLayers-Users] zIndexing does not work

Carsten Eider eider at fh-bingen.de
Wed Oct 12 15:59:37 EDT 2011


Hi Juergen,

why don't you work with two different layers?
One with the city without actual data and on top of these a layer with data!

Carsten

Am 12.10.2011 21:38, schrieb Jürgen Dankoweit:
> Hello to the list,
>
> In a map I want to show cities that have actual weather data in
> foreground and cities that do not have actual data behind the other cities.
> After long time of googling I don't know why zIndexing in my code does
> not work.
>
> Many thanks for the answers
>
> Juergen
>
> Here are the code snippets:
>
> var z_Index = (data_cnt == 10 ? 1000 : -1000);
>
> vectorLayer_Stadt = new OpenLayers.Layer.Vector("Stadt", {
>   styleMap: styleMap_Stadt,
>   renderers: renderer,
>   rendererOptions: {
>    zIndexing: true
>   },
>   displayInLayerSwitcher: false
> });
>
>
> First try:
> ==========
> var styleMap_Stadt = new OpenLayers.StyleMap({'default':{
>   label : "\${text}",
>   fontColor: '\${fcolor}',
>   fontSize: "14px",
>   fontFamily: "Gentium",
>   fontWeight: "bold",
>   labelAlign: "cm",
>   labelXOffset: 0,
>   labelYOffset: 0,
>   graphicZIndex: "${zIndex}"
> }});
>
> point = new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat);
> point.style = {
>  graphicZIndex: z_Index
> };
>
> pointFeature_Stadt = new OpenLayers.Feature.Vector(point);
>  pointFeature_Stadt.attributes =
>   {text: stadt, fcolor: text_color};
>  vectorLayer_Stadt.addFeatures([pointFeature_Stadt]);
>
> Result:
> =======
> No changes in the zOrder
>
> Second try:
> ===========
>
> var styleMap_Stadt = new OpenLayers.StyleMap({'default':{
>   label : "\${text}",
>   fontColor: '\${fcolor}',
>   fontSize: "14px",
>   fontFamily: "Gentium",
>   fontWeight: "bold",
>   labelAlign: "cm",
>   labelXOffset: 0,
>   labelYOffset: 0,
> }});
>
>
> pointFeature_Stadt = new OpenLayers.Feature.Vector(point);
>  pointFeature_Stadt.attributes =
>   {text: stadt, fcolor: text_color, zIndex = z_Index};
>  vectorLayer_Stadt.addFeatures([pointFeature_Stadt]);
>
> Result:
> =======
> No changes in the zOrder
>
>



More information about the Users mailing list