<div dir="ltr">Hi ramya,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I was able to draw a circle on the map with specified radius. I have done this in C#.net. Following steps will help you achieve the desired result.<br>&nbsp;<br>First, initialize the scale of the map by doing map.prepareQuery(); map is nothing but the mapobject<br>
Then,get the scale of the map<br>Divide the screen map resolution by 2.54 (because 1cm = 2.54 pixels).<br>&nbsp;The above 3 steps are needed to get a circle of exact radius, else the circle will not be accurate.<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; 4.&nbsp;&nbsp; Get the image point that is clicked on the map (i.e. the center of the circle) and&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; convert the image point to map point (i.e. pixel to point).<br>
&nbsp;&nbsp;&nbsp; 5.&nbsp;&nbsp;&nbsp; Use <br>if (layer.queryByPoint(map, point, mapscript.MS_SINGLE, tolerance) == <br>(<br>int)MS_RETURN_VALUE.MS_SUCCESS) <br>to identify the feature.<br>&nbsp;&nbsp; 6.&nbsp; Open the layer using layer.open();<br>&nbsp;&nbsp; 7.&nbsp; Divide the radius by the scale and multiply by 1000 to convert centimeter to kilometer&nbsp;&nbsp; (scale returned by the map object (in centimeters))<br>
&nbsp; 8.Create a shape object for circle <br>shapeObj<br>oShp = new shapeObj((int)MS_SHAPE_TYPE.MS_SHAPE_POLYGON); <br>&nbsp;9. Add a line object to the above created shape object.<br>10. Apply a for loop to get the points on the circumference of the circle and add it to the line object.<br>
for<br>(int iDegree = 0; iDegree &lt;= 360; iDegree = iDegree + 10) <br>&nbsp;For circle, we need the for loop to go from 0 to 360 degrees.<br>&nbsp;<br>11. Once all the points are added to the line object, after the end of the for loop, add that line to the shape object (for circle). <br>
oShp.add(oLine);<br>12. Once you get the shape, create a temporary layer and assign the properties/attributes like opacity, outline color, color of circle etc.<br>13. Finally, draw this layer and call the layer.close() method .<br>
&nbsp;<br>&nbsp;Thanks and Regards,<br>Sucharita Samuel<br>iWorkTechnologies Pvt. Ltd., Pune<br><br><br><br><div class="gmail_quote">On Sun, Sep 7, 2008 at 9:20 PM, ramya srinivasan <span dir="ltr">&lt;<a href="mailto:hellomps@gmail.com">hellomps@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><div>Hi all, </div>
<div>&nbsp;<i>&nbsp;I want to draw a circle with the center clicked by the user on the map.Can anyone help me??</i></div>
<div><i></i>&nbsp;</div>
<div><i>Thanks</i></div></div>
<br>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br></div>