Here's an example of creating two layers like you said, one polygon layer and one circle layer.
Working Example
It first creates the polygon from the coords you provided above and then creates a 3 kilometer radius circle from the centroid of that feature.
Update per comment:
/*
* APIMethod: createGeodesicPolygon
* Create a regular polygon around a radius. Useful for creating circles
* and the like.
*
* Parameters:
* origin - {<OpenLayers.Geometry.Point>} center of polygon.
* radius - {Float} distance to vertex, in map units.
* sides - {Integer} Number of sides. 20 approximates a circle.
* rotation - {Float} original angle of rotation, in degrees.
* projection - {<OpenLayers.Projection>} the map's projection
*/
Update #2 Per Comment:
So if you'd like to style all the features in the layer the same you could add the style at the layer level:
var vectorLayer = new OpenLayers.Layer.Vector("myPolygonLayer", {
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
fillColor: "#33CC00",
strokeColor: "#000000",
strokeWidth: 1
})
})
});
Or you can style it at the individual feature level:
var style_Green_Box = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
style_Green_Box.strokeColor = "#000000";
style_Green_Box.fillColor = "#33CC00";
style_Green_Box.strokeWidth = 1;
circleFeature.style = style_Green_Box;
Here's the DEMO Update which shows this.
You need to use a context to allow you to write a function to assign a kml attribute to your features.
The problem is that the kml attributes are not simple attributes - they are actually objects. You cannot assign an object to a feature attributes.
See this earlier question:
openlayers attribute substitution failing on kml file
P.S. I was logged in incorrectly, so ignore my other (junk) username
Best Answer
to style your kml use (this is just an example, check here for more):
then you show the kml with this using the styles:
To filter your kml, you can use this (this is just an example):
Read this to have more options to solve your issue.