[OpenLayers-Users] zIndexing does not work

Jürgen Dankoweit Juergen.Dankoweit at T-Online.de
Wed Oct 12 15:38:46 EDT 2011


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


-- 
Meine stets unfertige Homepage: www.dankoweit.de


More information about the Users mailing list