[OpenLayers-Dev] Hide/Show Feature + KML + Stylemap

Thomas PAPIN thomas.papin at gmail.com
Wed Aug 4 09:04:28 EDT 2010


Hi, it's again me :)

When I want to hide/show a feature, I just do in a normal case:
feature.style.display = "none";
This is working great.

But in the following case it's not working, and I don't have what to do.

- I have a KML with placemark (Point and Polygon)
- Each Placemark have attributes like (fontColor,label,labeloffestY)
- I used a StyleMap to style the features of this KML
like that:
var extraMap = new OpenLayers.StyleMap({'default':{
            fillOpacity: 1,
            pointRadius: "${pointSize}",
            label : "${label}",
            fontColor: "${fontColor}",
            fontSize: "${labelSize}px",
           ....

GMLlayer = new OpenLayers.Layer.GML(json.files[i].name, json.files[i].kml,
                                            {
                                                format:
OpenLayers.Format.KML,
                                                formatOptions: {
                                                    extractStyles: true,
                                                    extractAttributes: true,
                                                    maxDepth: 2
                                                    },
                                                styleMap: style
                                            });

Then when I tried to do feature.style.display but feature.style is not
defined.

What can I do :-( ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100804/c5bd9627/attachment.html


More information about the Dev mailing list