[Mapserver-users] Draw circle with polygon

Lowell Filak lfilak at medinaco.org
Wed Mar 17 09:41:51 EST 2004


I think you may need to check out the symbolscale under the layer object.
Also in you mapscript code you should not need to add a point to a line
object in order to add to a point shapefile.
$shpFile->addPoint(pointObj) should suffice.

HTH

Lowell

The following message was sent by "Gijs Epping" <gijs at gijs.com> on Wed,
17 Mar 2004 14:18:14 +0100.

> Hello,
>  
> I am trying to draw a circle that has to scale with the map, I have some
> code now (see below) but that doesn't do the trick it just shows a
> circle that doesn't scale with the map (It just stay's the same width if
> I set a different extension). 
>  
> I think i need to create a polygon that is connected to a point, but I
> don't know how at the moment if somebody could give me a push in the
> right direction it would be great.
>  
> Thanks in advance
> Gijs
>  
>  
> function createPoint( $x, $y, $programId )
>    {
>       GLOBAL $shpFile, $dbfFile;
>  
>       // Create shape
>       $oShp = ms_newShapeObj(MS_SHAPE_POINT);
>       $oLine = ms_newLineObj();
>       $oLine->addXY($x, $y);
>       $oShp->add($oLine);
>       $shpFile->addShape($oShp); // Write attribute record
>       dbase_add_record($dbfFile, array($programId));
>    }
>  
>    $shpFname = "/var/www/html/atmsv03/proximity";
>    $shpFile = ms_newShapeFileObj($shpFname, MS_SHP_POINT);
>    $dbfFile = dbase_create( $shpFname.".dbf", array(array("ID", "N", 5,
> 0)));
>  
>    createPoint($punt[0], $punt[1], 1); // the points come from an area
> code point
>  
>    $shpFile->free();
>    dbase_close($dbfFile);
>  
>    // Set the buffer distance
>    $pt_layer = $map->getLayerByName("proximity");
>    $pt_layer->set("status", MS_ON);
>    $pt_class = $pt_layer->getclass(0);
>  
>  
>  
>  
> The map file part:
>  
> LAYER
>  NAME "proximity"
>  data proximity
>  STATUS off
>  TYPE POINT
>  SIZEUNITS meters
>  TRANSPARENCY 50
> CLASS
>  SIZE 1000
>  NAME 'transcircle'
>  SYMBOL 'transcircle'
>  COLOR 255 0 0
>  END
> END
> SYMBOL
>  NAME 'transcircle'
>  TYPE ELLIPSE
>  POINTS 1 1
>  END
>  FILLED TRUE
> END
>  
>  
>  
>  
> 




More information about the mapserver-users mailing list