How do I create a new shapeObj from a list of shapeobj?

Frederico Lucca fredlucca at GMAIL.COM
Tue May 2 14:24:24 EDT 2006


Bryon,

I have something in java...

public void addLine(double[] arg){

        lineObj line = new lineObj();

        for(int i=2;i<arg.length;i=i+2){

            pointObj p = new pointObj(arg[i],arg[i+1],0);
            line.add(p);

        }

        layerObj layer = map.getLayerByName("COSMETIC");
        shapeObj shape = new shapeObj(mapscript.MS_SHAPE_LINE);
        shape.add (line);

        layer.addFeature(shape);

    }

WHERE COSMETIC IS:

LAYER
 NAME COSMETIC
 TYPE LINE
 STATUS DEFAULT
 CLASS
  STYLE
   SIZE 5
   SYMBOL 'street'
  END
  COLOR 255 0 0
  OUTLINECOLOR 171 158 137
 END
END

I use this to add a line to the map, temporarily.

[]'s

Fred

--
"Everything under the sun is in tune
But the sun is eclipsed by the moon"

On 4/27/06, Bryon Kenne <bryon at peoplegis.com> wrote:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060502/702ae30e/attachment.html


More information about the mapserver-users mailing list