# How to make a predetermined Polygon (Circle) From 4 Coordinates, The Radius and Center Longitude and Latitude in Openlayers

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))"
)
);
``````

I have made a 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.

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 cant 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.

-

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

``````var origin = "new OpenLayers.Geometry.Point(Long Lat)";
Yes, and for origin use the center point of your bounds by doing a myBounds.getCenterLonLat(). example: `var originLonLat = myBounds.getCenterLonLat(); var origin = new OpenLayers.Geometry.Point(originLonLat.lon originLonLat.lat);` – CaptDragon Apr 18 '12 at 17:30