[mapserver-users] How to create [n]mile radius polygon(circle )

Timothy.Mackey at agso.gov.au Timothy.Mackey at agso.gov.au
Thu Sep 27 18:33:31 EDT 2001


Hi John,

I create circles in mapscript like this (with a layer called "circle"
already in the mapfile):

     $p=new pointObj();
     $circle=new shapeObj($mapscript::MS_LINE);
     $line=new lineObj();
     $layer = $map->getLayerByName('circle');
     $class = $layer->getClass(0);

     $pi=3.141592654;
     for($i=0;$i<2.1*$pi;$i=$i+$pi/100)
       {
       $p->{x} = $x + $radius * cos($i);
       $p->{y} = $y + $radius * sin($i);
       $line->add($p);
       }
     $circle->add($line);
     $circle->draw($map,$layer,$img,undef,"damage");


Tim Mackey
Internet Applications Manager
AGSO - Geoscience Australia
e-mail: timothy.mackey at agso.gov.au
phone: (02) 6249 9813
fax: (02) 6249 9984
http://www.agso.gov.au/
ABN: 80 091 799 039



-----Original Message-----
From: Arthur, John [mailto:John.Arthur at voicestream.com]
Sent: Friday, 28 September 2001 6:59 AM
To: mapserver-users
Subject: [mapserver-users] How to create [n]mile radius polygon(circle)


How can i create a [n]mile radius circle either with a polygon or symbol.

I have managed to create a crude oval octigon based on 12 lat/long points
but I cant seem to get a smooth circle or the correct mile radius.


John Arthur



More information about the mapserver-users mailing list