I have a kml file which contains some polygon and some point features in the same file. I am trying to load and view this layer on my basemap in OpenLayers. The problem is that the polygon features will be drawn on map but not the points.
Does this mean that a layer cannot containt both polygons and points in it at the same time? What sollution would you suggest to solve this?
(I need these features in one layer and not seperate). Thank you.
The code for loading the data in OpenLayers:
Grid = new OpenLayers.Layer.Vector("grid layer", { eventListeners: {
'featureselected': function (evt) {},
'featureunselected': function (evt) {},
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "sample.kml",
format: new OpenLayers.Format.KML({
extractStyles: false,
extractAttributes: true,
maxDepth: 2
})
}),
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style(OpenLayers.Util.applyDefaults({
pointRadius: 6,
strokeWidth: 1,
strokeColor: "Black",
fillColor: "Gray",
fillOpacity: 0.4
}, OpenLayers.Feature.Vector.style["default"])),
"select": new OpenLayers.Style({
fillColor: "Blue",
fillOpacity: 1
})
})
});
map.addLayer(Grid);