[OpenLayers-Users] Z-Ording for Label inside of a Point

Aaron Edwards Aaron.Edwards at rms.com
Mon Mar 19 17:42:27 EDT 2012


Hi OpenLayers Community,

This is my first post to the mailing list.

I'm trying to render an OpenLayers.Feature.Vector as a circle, with a label in it.

I'm setting the zOrder of the Vector when I create it, but the Style.Label property seems to be unaffected by it.  Basically if some of my circles overlap, all the labels show through. Here is my code:

        var features = [];

        // clusters is an array brought back from a REST service
        for (var i = 0; i < clusters.length; i++) {
            var cluster = clusters[i];

            var pnt = new OpenLayers.Geometry.Point(cluster.Longitude, cluster.Latitude);
            var vec = new OpenLayers.Feature.Vector(pnt);
            vec.zIndex = i + 1;

            // myMarkerStyle is a globally defined style (strokeColor, fillColor etc), that I clone here to just change the properties I'm interested in
            vec.style = cloneObject(myMarkerStyle);
            vec.style.pointRadius = interpolateSize(cluster.Count);
            vec.style.label = "" + i;

            features.push(vec);
        }

        MyFeatureLayer.addFeatures(features);

Thanks!

Aaron

________________________________
This message and any attachments contain information that may be RMS Inc. confidential and/or privileged. If you are not the intended recipient (or authorized to receive for the intended recipient), and have received this message in error, any use, disclosure or distribution is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to the e-mail and permanently deleting the message from your computer and/or storage system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120319/68644c5f/attachment-0001.html


More information about the Users mailing list