You can define the labels in the stlyeMap you assign to the vector layer. 
Example below...

var roads, myStyles:

roads = new OpenLayers.Layer.Vector("My Roads", {
                'displayInLayerSwitcher': true,
                styleMap: myStyles,
                projection: map.displayProjection,
                strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.HTTP({
                    url: "phpsql_genkml.php?viewport="+viewport,
                    format: new OpenLayers.Format.KML({
                        extractStyles: false,
                        extractAttributes: true
                    })
                })
            });

myStyles = new OpenLayers.StyleMap({
                "default": new OpenLayers.Style({
                                strokeColor: "#FFCC33",
                                strokeWidth:1,
                                strokeOpacity:1,
                                fillColor:"#003399",
                                fillOpacity: 0,
                                label : "${name}"
                }),
                "select": new OpenLayers.Style({
                                strokeColor: "#B0FFFF",
                                strokeWidth:3,
                                strokeOpacity:1,
                                fillColor:"#B0FFFF",
                                fillOpacity: 0.4
                })
            });
-- 
View this message in context: 
http://n2.nabble.com/vector-labels-using-kml-tp4802937p4803618.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to