php help

Steve Lime Steve.Lime at DNR.STATE.MN.US
Fri Apr 28 11:01:15 EDT 2006


You can only add lines to a shape so the psuedo code would look like (I think you're missing the inner loop):

new_shape = new shapeObj(MS_SHAPE_LINE)
for each shape in the list {
  for each line in the shape {
    new_shape->add(line)  
  }
}

buffered_shape = new_shape->buffer(width)

shapefile = new shapefileObj()
shapefile->add(buffered_shape)

Steve

>>> Kevin Flanders <kevin at PEOPLEGIS.COM> 4/28/2006 9:01:22 AM >>>
I am retrieving a list of shapes from a line shapefile file using the
following code:

for($x=0;$x<count($oShapeList);$x++)
{
   $oSelectedShape = $oRelationLayer->getshape(-1, $oShapeList[$x]);
   array_push($oShapeObjectList,$oSelectedShape);
}

I want to merge this list of shapes into one shape (i.e. one line).  I
thought I could do it using the following code but it returns a "Fatal
error: Object has an invalid _handle_ property":

$oLine = ms_newShapeObj(MS_SHAPE_LINE);
For($x=0; $x<count($oShapeObjectList);$x++)
{
   $oLine->add($oShapeObjectList[$x]);
}

The goal here is to create one line, then use the GEOS - buffer(width) to
create a polygon object that I can save to a new shapefile.

Does anybody have any ideas? OR CODE!!!

Sincerely,

Bryon



More information about the mapserver-users mailing list