[mapserver-users] Drawing a circle on a map

Stephen Woodbridge woodbri at swoodbridge.com
Sun Apr 13 12:37:07 EDT 2008


Atul Dravid wrote:
> Try asking for Sample Code to Stephen Woodbridge...
> 
> On 4/12/08, *Stephen Woodbridge* <woodbri at swoodbridge.com 
> <mailto:woodbri at swoodbridge.com>> wrote:
> 
>     Sucharita Samuel wrote:
> 
>         Hi all,
>                I want to draw a circle of 5 km radius around the point I
>         click on the map. I am using C# mapscript. Even if you can help
>         me with the php code, it will be of great help.
> 
> 
>     One way to do this is to create a template layer that defines a
>     feature that is a circle with the STATUS OFF. Then in mapscript you
>     can get the layer, set the status to ON and set the value of the
>     origin of the feature and have mapserver draw it on top of your map.
> 
>     -Steve W.
> 
>     _______________________________________________
>     mapserver-users mailing list
>     mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 

In mapscript you can change the status and the feature points to be what 
you want. Here is an example of the LAYER and a URL to display it. I 
will leave the mapscript as you homework assignment :) Actually, I don't 
have a simple example handy, nor the time to put one together at the 
moment. If you get stuck an a specific point ask the list, there are 
plently of people that can help with mapscript.

-Steve

MAP
   EXTENT -180 -90 180 90
   IMAGECOLOR 255 255 0
   IMAGETYPE png
   SIZE 400 200
   UNITS DD

   LAYER
     NAME "circles"
     TYPE circle
     STATUS DEFAULT
     FEATURE
       # define circle as two points describing the opposite corners of
       # of the bounding square about the circle
       POINTS
         -10.0 -10.0
          10.0  10.0
       END
     END
     CLASS
       STYLE
         OUTLINECOLOR 255 0 0
       END
     END
   END
END

http://mt2.imaptools.com/cgi-bin/mapserv-5.1-dev?mode=map&map=/u/data/maps/circles.map




More information about the mapserver-users mailing list