php help
Bryon Kenne
bryon at PEOPLEGIS.COM
Fri Apr 28 10:59:26 PDT 2006
Steve,
I interpreted your outline as best I could into PHP code, but my code
is dying at the inner loop. I don't think I am calling the individual
lines from the shape correctly....
Here is my code:
$new_shape = ms_newShapeObj(MS_SHAPE_LINE);
foreach ($oShapeObjectList as $Shape)
{
foreach ($Shape as $line) {
$new_shape->add($line);
}
}
$buffered_shape = $new_shape->buffer($dfTolerance);
$shapefile = ms_newShapeObj(MS_SHAPE_POLYGON);
$shapefile->add(buffered_shape);
Any Ideas?
Sincerely,
Bryon
On 4/28/06, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
> 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
>
--
Bryon Kenne
PeopleGIS, Inc.
Direct/Cell: (917)671-6951
Email: bryon at peoplegis.com
More information about the MapServer-users
mailing list