[mapserver-users] No fill after creating a shapeObj

Arthur, John John.Arthur at voicestream.com
Wed May 22 09:10:24 EDT 2002


What am I doing wrong?  The following example will create a shape (line),
but it will not be filled.  I works if I use similar code for dynamic
layers, but fails to fill if I write it to a shp file.  Thanks for your
help.

example:--------------------------------------------------

$shpFile = ms_newShapeFileObj( $shpFname, MS_SHP_POLYGON);
$dbfFile = dbase_create( $shpFname.".dbf", <!-- My field array here -->);
$oShp = ms_newShapeObj(MS_SHAPE_POLYGON);
$oLine = ms_NewLineObj();
$mid_h=90;
$beg_h=$mid_h+(($horizontal/2)-$horizontal);
$midbeg_h=$mid_h+((($horizontal/2)+($horizontal/4))-$horizontal);
$midend_h=$mid_h+((($horizontal/4)*5)-$horizontal);
$end_h=$mid_h+((($horizontal/2)*3)-$horizontal);

$oLine->addXY($x, $y);
$oLine->addXY($x + 0.015 * 0.4 *
cos((($orientation*-1)+$beg_h)*3.14159265/180), $y + 0.015 * 0.4 *
sin((($orientation*-1)+$beg_h)*3.14159265/180));
$oLine->addXY($x + 0.015 * 0.4 *
cos((($orientation*-1)+$midbeg_h)*3.14159265/180), $y + 0.015 * 0.4 *
sin((($orientation*-1)+$midbeg_h)*3.14159265/180));
$oLine->addXY($x + 0.015 * 0.4 *
cos((($orientation*-1)+$mid_h)*3.14159265/180), $y + 0.015 * 0.4 *
sin((($orientation*-1)+$mid_h)*3.14159265/180));
$oLine->addXY($x + 0.015 * 0.4 *
cos((($orientation*-1)+$midend_h)*3.14159265/180), $y + 0.015 * 0.4 *
sin((($orientation*-1)+$midend_h)*3.14159265/180));
$oLine->addXY($x + 0.015 * 0.4 *
cos((($orientation*-1)+$end_h)*3.14159265/180), $y + 0.015 * 0.4 *
sin((($orientation*-1)+$end_h)*3.14159265/180));
$oLine->addXY($x, $y);

$oShp->add($oLine);   

$oShp->add( $oLine );
$shpFile->addShape($oShp);

dbase_add_record($dbfFile, <!-- My field array here -->);

John Arthur
RF Technician
Office:   (757) 490-7221
Cellular: (757) 692-1515
Email: john.arthur at voicestream.com
VoiceStream Wireless
Global Wireless by
···T···Mobile·




More information about the mapserver-users mailing list