<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000099" bgcolor="#ffffff">
    <font size="-1"><font face="Verdana">It would be a good idea to add
        this function to OpenLayers.Geometry.Polygon along with
        createRegularPolygon that is already there. Something like
        createGeodesicRegularPolygon as there is getGeodesicArea.<br>
        <br>
        Janis<br>
      </font></font><br>
    On 2011.06.06. 8:20, Michael wrote:
    <blockquote cite="mid:4DEC6399.4040306@yachtpc.com" type="cite">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      Regular Polygons are fine for many applications.  I needed range
      rings for ocean races, which did not correctly reflect the
      projection of the map.  Although it projected like a nice round
      circle, the correct shape should have been oval.<br>
      <br>
      Did not find a geographic circle function in OL, so I adapted one
      from one found online.<br>
      <br>
      I present it here should anyone want it, or have a better idea, or
      want to point out that this was in OL all along.<br>
      <br>
      <b>function GeoCircle(latin, lonin, radius)// thanks to VE site
        for basic algo. Returns an OL Polygon of diameter in nautical
        miles<br>
          {<br>
            var locs = new Array();<br>
            var lat1 = latin * Math.PI/180.0;<br>
            var lon1 = lonin * Math.PI/180.0;<br>
            var d = radius/3440.07;// change this value to the radius of
        the Earth in your units<br>
            var x;<br>
            for (x = 0; x &lt;= 360; x+=6)  //gives 60 points.  More
        than enough for a smooth circle most likely<br>
            {<br>
                var tc = (x / 90)* Math.PI / 2;<br>
                var lat =
Math.asin(Math.sin(lat1)*Math.cos(d)+Math.cos(lat1)*Math.sin(d)*Math.cos(tc));<br>
                lat = 180.0 * lat / Math.PI;<br>
                var lon;<br>
                 if (Math.cos(lat1)==0)<br>
                {<br>
                    lon=lonin; // endpoint a pole<br>
                }<br>
                else<br>
                {<br>
                    lon = ((lon1 - Math.asin(Math.sin(tc) *
        Math.sin(d)/Math.cos(lat1)) + Math.PI) % (2 * Math.PI)) -
        Math.PI;<br>
                }<br>
                lon = 180.0 * lon / Math.PI;<br>
                var loc = new pt(lon,lat);<br>
                locs.push(loc);<br>
            }<br>
            var poly = new OpenLayers.Feature.Vector(new
        OpenLayers.Geometry.Polygon(new
        OpenLayers.Geometry.LinearRing(locs)));<br>
            <br>
            return poly;  //this can be added to a map<br>
        }<br>
      </b><br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
    </blockquote>
  </body>
</html>