[OpenLayers-Users] Can not Extract KML Attribute

reinaldo at geodesign.com.br reinaldo at geodesign.com.br
Fri Nov 30 04:38:28 PST 2012


OL Users,

Could some one please help?

I can not extract attributes in a KML file. Here is my KML:
         ba_uf
               ff0000ff
               0
                  2909901
                  Nordeste>
                  BAHIA>
                  0
            1
                         -39.76265494838268,-12.27246488227016,0 
-39.48325151827876,-12.09283133762983,0 
-39.41905766787695,-11.8699639552835,0 
-39.36482198574752,-11.65858652001503,0 
-39.76422342556302,-11.64471479218556,0 
-40.04350054605078,-11.82438907570092,0 
-40.01005372231482,-12.1350573465942,0 
-39.76265494838268,-12.27246488227016,0 
This what I am using to extract and style the attributes:

..
        new OpenLayers.Layer.Vector("ESTADO DA BAHIA", {
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "kml/ba_uf_900913a.kml",
                format: new OpenLayers.Format.KML({
                   extractStyles: false, 
                   extractAttributes: true,
                   srsName: "EPSG:900913"
                })
            }),
                style: {
                  fillColor: "#ffffff",
                  fillOpacity: 0,
                  strokeWidth: 1, 
                  strokeColor: "#0000ff", 
                  strokeOpacity: 1,
                  label: "S{State}",
                  fontColor: "#ffffff",
                  fontFamily: "sans-serif",
                  fontSize: "15px",
                  fontWeight: "bold"
                }
..

I want the attribute for State to be rendered on the map, but I only get
S{State} rendered.

I've  tried additng  and label: "S{State}" or  label: "S{State.value}" . I
get either S{State} or S{State.value}  rendered on the map, but never the
actual attribute, which is BAHIA.

I just can´t get it to work. Could someone help please?

Thanks a lot in advance.

Reinaldo
------------------------------------
 Reinaldo Escada Chohfi
 Sócio Gerente
 GeoDesign Internacional
 www.geodesign.com.br (http://www.geodesign.com.br)
 Tel./Fax: (12) 3153-5115
 Inteligência e Tecnologia Espacial de Ponta

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121130/6c0ebf6e/attachment.html>


More information about the Users mailing list