Dear list,
I'm trying to load a layer from a local file, using a GML or KML format
based on file extension, and applying the same styleMap in both cases.
The following code only works for GML but not for KML format.
The var filename is the file to load and the var layertype is the extension
of the file.
Any hint?
Thanks a lot
Mauro
var symbolizer = OpenLayers.Util.applyDefaults(
{fillColor:'red', fillOpacity: 0.4, strokeColor: "black"},
OpenLayers.Feature.Vector.style["default"]);
styleMap = new OpenLayers.StyleMap({"default": symbolizer});
if(layertype == 'gml')
overlay = new OpenLayers.Layer.GML("GML", filename,
{extractAttributes:
true, styleMap: styleMap});
else if(layertype == 'kml')
overlay = new OpenLayers.Layer.GML("GML", opts['layer'], {
projection: map.displayProjection,
styleMap : styleMap,
format: OpenLayers.Format.KML,
formatOptions: {
extractStyles: false,
extractAttributes: true
}
});
--
View this message in context:
http://n2.nabble.com/GML-and-KML-styleMap-tp2339910p2339910.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users