Hi Imran, the first argument is the geometry which marks the center of the circle. In my case this is an already existing geometry but you can create a point yourself
Cheers Kris Met vriendelijke groet, Kind regards, Kristiaan Geusebroek Consultant On Aug 28, 2010, at 2:27 PM, Imran Rajjad wrote: ok I think I have done it ...this is how i did it.. it was really very easy.. //the following code draws a circle with radius given in terms of degrees e.g 0.00005 degrees and will take the 2nd vertex of the first feature insie a vector layer. var outercircle =new OpenLayers.Geometry.Polygon.createRegularPolygon(wmsSelection.features[0].geometry.getVertices()[2],radius, 360, 0); var buffer1 = new OpenLayers.Feature.Vector(outercircle); buffer1.geometry.calculateBounds(); var innercircle =new OpenLayers.Geometry.Polygon.createRegularPolygon(wmsSelection.features[0].geometry.getVertices()[2],radius/2, 180, 0); var buffer2 = new OpenLayers.Feature.Vector(innercircle);// adding geometry to feature buffer2.geometry.calculateBounds(); // calculating bounds wmsSelection.addFeatures([buffer1,buffer2]); // addding features to a vector layer regards, Imran On Thu, Aug 26, 2010 at 6:03 PM, Kris Geusebroek <kgeusebr...@xebia.com<mailto:kgeusebr...@xebia.com>> wrote: Hi I Think you can use var circle = OpenLayers.Geometry.Polygon.createRegularPolygon(ft.geometry, selectedRadius, 50); as far as i know the radius is in the distance unit of the projection of the layer, so if you have a layer in the Dutch RD projection for example it's in meters, if the projection is WGS84 it's degrees the 50 is as already mentioned the amount of vertices Hope this helps Met vriendelijke groet, Kind regards, Kristiaan Geusebroek Consultant <image005.jpg> <image006.png> Email: kgeusebr...@xebia.com<mailto:kgeusebr...@xebia.com> Tel: +31 (0)35 538 1921 Fax: +31 (0)35 538 1922 Mobiel: +31 (0)6 3069 7223 Utrechtseweg 49 1213 TL Hilversum The Netherlands http://www.xebia.com<http://www.xebia.com/> Xebia Blog: http://blog.xebia.com/ Xebia Podcast: http://podcast.xebia.com/ On Aug 26, 2010, at 2:55 PM, Imran Rajjad wrote: @remi...my problem is simple, I`m trying to draw a circle by giving centre lat/long and radius in meters. in my first email I mentioned that I`m doing this already in native javascript through basic trignometry but I was looking for somthing in openlayers @Ralph..hmm ok buddy.. I`ll try that out,appreciate your help regards, Imran On Thu, Aug 26, 2010 at 5:50 PM, remi <remiglo...@gmail.com<mailto:remiglo...@gmail.com>> wrote: Hi imran, i don't really get your problem. From your first email, you state that you want to figure out the coordinates of the vertices in lat,long format. Is this what you want? me a noob here, but i'm trying to understand the prob. remi On Thu, Aug 26, 2010 at 8:29 PM, Imran Rajjad <raj...@gmail.com<mailto:raj...@gmail.com>> wrote: hmmm .. but my calculated radius problem is still there.. though i managed to calculate the vertices using geodetic distance On Thu, Aug 26, 2010 at 5:20 PM, Ralph Dell <rd...@catawbacountync.gov<mailto:rd...@catawbacountync.gov>> wrote: It will give you a polygon with 40 sides. While not technically a circle it works very well at looking like a circle. Ralph Dell, GISP GIS Dept. Catawba County, NC -----Original Message----- From: Imran Rajjad [mailto:raj...@gmail.com<mailto:raj...@gmail.com>] Sent: Thursday, August 26, 2010 8:16 AM To: Ralph Dell Cc: users@openlayers.org<mailto:users@openlayers.org> Subject: Re: [OpenLayers-Users] drawing a circle in openlayers hi, yea I checked this example but I`m not sure what is 40? is it a pixel value or some default unit.? regards, Imran On Thu, Aug 26, 2010 at 5:01 PM, Ralph Dell <rd...@catawbacountync.gov<mailto:rd...@catawbacountync.gov>> wrote: Have you tried the polygon control? // set up the polygon control, for drawing a circle polyOptions = {sides: 40}; polygonControl = new OpenLayers.Control.DrawFeature(circleLayer, OpenLayers.Handler.RegularPolygon, {handlerOptions: polyOptions}); map.addControl(polygonControl); .. polygonControl.handler.setOptions({radius: radiusx}); polygonControl.handler.activate(); Ralph Dell -----Original Message----- From: users-boun...@openlayers.org<mailto:users-boun...@openlayers.org> [mailto:users-boun...@openlayers.org<mailto:users-boun...@openlayers.org>] On Behalf Of Imran Rajjad Sent: Thursday, August 26, 2010 7:32 AM To: <users@openlayers.org<mailto:users@openlayers.org>> Subject: [OpenLayers-Users] drawing a circle in openlayers Hi list, I`m trying to draw a circle geometry with a radius of 30m, currently I`m calculating lat/long of each vertex from the centre , i was hoping if this could be done through openlayers regards, Imran -- I.R _______________________________________________ Users mailing list Users@openlayers.org<mailto:Users@openlayers.org> http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list Users@openlayers.org<mailto:Users@openlayers.org> http://openlayers.org/mailman/listinfo/users -- I.R -- I.R _______________________________________________ Users mailing list Users@openlayers.org<mailto:Users@openlayers.org> http://openlayers.org/mailman/listinfo/users -- I.R _______________________________________________ Users mailing list Users@openlayers.org<mailto:Users@openlayers.org> http://openlayers.org/mailman/listinfo/users -- I.R
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users