[mapserver-users] generate shape file

Shaik Anwar Hussain shussain at atsincorp.com
Fri Dec 14 16:54:16 EST 2001


Hi List,

              Does any one know whats the wrong in this code, 

              this code  generating the shape file but when i open the shape
file in arcview i am not getting the lines.

<?php

dl("php_mapscript.dll");
dl("php_dbase.dll");

function createshape( $x, $y, $programId )
{
    GLOBAL $shpFile,$dbfFile;
    $oShp = ms_newShapeObj(MS_SHP_ARC);
    $oLine = ms_newLineObj();
    $oLine->addXY($x, $y);
    $oShp->add( $oLine );
    $shpFile->addShape($oShp);  
    dbase_add_record($dbfFile, array($programId));
}

$shpFname = 'C:\Program Files\Apache Group\Apache\htdocs\php\test5';
$shpFile = ms_newShapeFileObj( $shpFname, MS_SHP_ARC);
$dbfFile = dbase_create($shpFname.".dbf", array(array("PROG_ID","N",5,0)));
 
createshape( 12, 34, 111);
createshape( 22, 14, 222);
createshape( 10, 20, 333);

echo "Shapes Created.<BR>";

$shpFile->free();
echo "Shape File ($shpFname) closed.<BR>";

dbase_close($dbfFile);
echo "Dbase file closed. <br>";
 
?>
 
i am using php 4.0/mapscript 3.4 module.

Please try to look this problem.

Thanks for ur time,
Hussain



More information about the mapserver-users mailing list