MapScript lineObj to create a Point?
Eric Bridger
eric at GOMOOS.ORG
Tue Feb 1 05:24:54 PST 2005
At 09:13 PM 01/31/2005 -0800, Tyler Mitchell wrote:
>Am I reading the docs right?
>
>I want to create a point shapefile, but need to first create a lineObj
>and .add() to it. Then .add() that lineObj to my ShapeObj...then .add() that
>to my shapefileObj?
>
>This is the best I can come up with as an example. Can I shortcut this at
>all?
>
>myPoints = mapscript.pointObj(-121, 54)
>myShapes = mapscript.shapeObj(0)
>myLine = mapscript.lineObj()
>myLine.add(myPoints)
>myShapes.add(myLine)
>myShapefile = mapscript.shapefileObj("myshapefile.shp",1)
>myShapefile.add(myShapes)
You can use
Shapefile.addPoint(Points); when dealing with Shape files.
But when using Layer.addFeature(Shape) to add Points to a map for drawing you cannot use a Point object but must create a single point line, as you are doing above, because a mapscript Shape object vs. a ShapeFile object does not have an addPoint method, just addShape(lineObj).
Eric
More information about the MapServer-users
mailing list