Open a shapefile and read its shapes' attributes
Jedi Knight
friendvn2000 at YAHOO.COM
Wed Jul 11 20:11:22 PDT 2007
Hi all,
I want to open a line shapefile (routes.shp) and read attribute (RouteName)
from it.
My codes here:
<?php
$Path = '\ms4w\apps\map\routes.shp'; // must use full path [:(]
$LineFile = ms_newShapefileObj($Path,-1); // open for read-only
$numshapes = $LineFile->numshapes;
if($numshapes > 0)
{
for($i = 0; $i < $numshapes; $i++)
{
$Line = $LineFile->getShape($i);
$RouteName = $Line->values["RouteName"];
printf($RouteName ); // it show nothing
$Line->free();
}
}
$LineFile->free();
?>
But it doesn't works!
Can someone explain to me. Thanks!
More information about the MapServer-users
mailing list