[Mapserver-users] Shape problems

Fernando S. simon at inf.univali.br
Wed Nov 12 07:33:07 EST 2003


Dear list,  

  I'm having difficulty to create line type shapefiles, the problems is 
the Mapserver closing the shape.
  The script closes the line, the first point with the last point of 
line. How can I fix this?
  I'm using this code to generate the shape:

<?php
set_time_limit(0);
include_once( "dual/oci.inc" );

dl( 'php_mapscript.so' );

ociConectar();   //database conection

function createShape($programId, $pname )
{
    GLOBAL $shpFile,$dbfFile;

    $query = "select x.* from hidrografia_sc h, table (SELECT 
h.COORDENADA.SDO_ORDINATES FROM hidrografia_sc h WHERE h.codigo_ott = 
83851000) x";    //query

    ociExecutar($query);  //execute query

    $oShp = ms_newShapeObj(MS_SHAPE_LINE);
    $oLine = ms_newLineObj();

    while (list($x) = ociTupla())
    {
        list($y) = ociTupla();
        $point = ms_newPointObj();
        $point->setXY( $x, $y );
        $oLine->add($point);
    }

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

    dbase_add_record($dbfFile, array($programId, $pname ));

}

$shpFname = "/home/apache/htdocs/tmp/pol";
$shpFile = ms_newShapeFileObj( $shpFname, MS_SHP_ARC);
$dbfFile = 
dbase_create($shpFname.".dbf",array(array("ID","N",5,0),array("NAME","C",10)));

createShape(1,"River");

echo "Shapes Created.<BR>";

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

dbase_close($dbfFile);
echo "Dbase file closed. <br>";

ociEncerrar();     //close connection
ociDesconectar();
?>



Fernando Simon
simon at cttmar.univali.br





More information about the mapserver-users mailing list