[Mapserver-users] addPoint problems, again
Ken-ichi
kueda at wso.williams.edu
Mon Apr 5 11:24:45 PDT 2004
Hi list. I posted this a few days ago, but I haven't worked out the
problem yet. Please tell me if I'm doing something stupid.
I'm new to MapServer and phpMapScript and I've run into a roadblock with
ShapefileObj's addPoint() function. I add the point, add a record to
the dbf (w/ almost no data), there are no errors, and the reported
number of shapes in the file increases by one, but the new point isn't
displayed. I've perused the list archives and haven't found anything
like this. Can anyone give me any advice? This may all stem from some
deep ignorance of the true and potentially infernal nature of
shapefiles. I've included my version info and code below if it helps.
This is all in Mac OS 10.3.
MapServer Version
MapServer version 4.0 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=PROJ
SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER INPUT=TIFF INPUT=EPPL7 INPUT=JPEG
INPUT=SHAPEFILE
PHP MapScript Version
($Revision: 1.177 $ $Date: 2003/07/30 19:01:31 $)
$my_point = ms_newpointObj();
$my_point->setXY($HTTP_POST_VARS["mapa_x"],$HTTP_POST_VARS["mapa_y"]);
//add the point
$targetFile = ms_newShapefileObj( "/path/to/file", -2 );
$temp = $targetFile->addPoint( $my_point );
echo "<p>result: $temp\n";//test
echo "<p>result: " . $targetFile->numshapes;//test
echo "<p>result: " . $targetFile->type;//test
echo "<p>result: " . $targetFile->source;//test
$targetFile->free();
//add the dbf record
$dbf = dbase_open( "/path/to/file.dbf", 2 );
$attr = array( "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "newpt", "",
"", "", "", "", "", "", "", "", "", "", "", "" );
if( !dbase_add_record( $dbf, $attr ) ) echo "<h2>Add Record
Failed!</h2>";
dbase_pack( $dbf );
Thanks in advance.
-Ken-ichi
More information about the MapServer-users
mailing list