[OpenLayers-Users] zIndexing does not work
Andreas Hocevar
ahocevar at opengeo.org
Wed Oct 12 16:15:26 EDT 2011
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.
Andreas.
On Oct 12, 2011 9:39 PM, "Jürgen Dankoweit" <Juergen.Dankoweit at t-online.de>
wrote:
> 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
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111012/51d793ac/attachment.html
More information about the Users
mailing list