I know how to make a predetermined polygon in OpenLayers (see below).
Please have a look at http://studio.netnrg.co.za/dev/rnd/blake.loizides/openlayers
var feature2 = new OpenLayers.Feature.Vector(
OpenLayers.Geometry.fromWKT("POLYGON((-120.828125 -50.3515625, -80.1875 -80.0078125, -40.40625 -20.4140625, -120.828125 -50.3515625))"
)
);
vectors.addFeatures([feature2]);
I have made an edit circle (40 points in OpenLayers) (my client wanted to see a circle on the map for zones).
The problem I have is that I can only store the following details and not the 40 points or coordinates or vertices to make a circle in OpenLayers. I can only STORE 4 COORDINATES.
In the database I store the bounds top bottom left and right (bottom: -29.054153382197, left: 23.782779686138, right: 23.79286499053, top: -29.044068077805) I will replace the coordinates with the ones in my database.
The radius (525.627982303084)
And the center Longitude and Latitude (lon=23.787822338334,lat=-29.049110730001)
Now I made some calculations below.
My question is how do I now recreate a (circle) with the information I have above that is stored in my database?
I know how to get data from my database and display it on the map, what I don't know is how to make a circle if I can't store the 40 points and only have the radius, the bounds, and the center Lon/Lat to make a circle.
Please if anyone can help me I would be greatly appreciative.
I only want a circle for the look and for no other reason.
Best Answer
I'm new to openlayers but this helped me you only need a center point (long lat) and a radius don't forget the function createGeodesicPolygon
Creating vector features onload in OpenLayers
there is a link to a demo
hope that helps