[Mapserver-users] Z values from 3D shapefiles (PHP MapScript)

Hankley, Chip Chip.Hankley at GASAI.Com
Mon Jan 6 12:43:28 EST 2003


Is there a way to access the Z-values of the vertices in a 3D shapefile? I
have a 3D LINE shapefile that I created in ArcView. When I try to loop
through the shapefile, each shape type is returned as MS_SHAPE_NULL. I'm not
able to access the individual 'lines', apparently, for this type.

The code I'm using is:

  //Open the shapefile and spit out the results for each line.
  $oShpFile = ms_newShapefileObj($shpPath, -1);
  for ($i=0;$i < $oShpFile->numshapes;$i++) {
    $oShp = $oShpFile->getShape($i);
    for($j=0; $j < $oShp->numlines; $j++) {
      $oLine = $oShp->line($i);
      for($k=0; $k<$oLine->numpoints; $k++) {
        $point = $oLine->point($k);
        echo $point->x . "," . $point->y . "," . $point->m . "<BR>";
      }
    //$oLine->free();
    }
  $oShp->free();
  }
  $oShpFile->free();

Thanks!

Chip



More information about the mapserver-users mailing list