[Mapserver-users] Creating dynamic shapefiles with Python Mapscript

Bjoern Platzen bplatzen at sosnetz.de
Tue Nov 18 09:01:09 EST 2003


Hi Michael.

Thanks a lot! Now it works...
... but the Error was caused by this:
myShape=mapscript.shapefileObj(shpName, mapscript.MS_SHAPE_POINT)
                                                     ^^^^^
It took me a minute to recognize the difference between your suggestion 
on how to create the shapefileObj and my function... 8~)

> if you only want to create a point data shapefile, you don't need to
> create a shapeObj/lineObj.
> You could just do:
>
> newshpfile =
> mapscript.shapefileObj(shpName,mapscript.MS_SHAPEFILE_POINT) #
> iterate over your result set
> for l in r[1]:
>   p = mapscript.pointObj()
>   p.x = l[0]
>   p.y = l[1]
>   newshpfile.addPoint(p)
> ...

But I think, I've got to build the lineObj and the shapeObj as well, to 
add them to the layer. If I only build the shapefile, my Features won't 
be visible on the map. Or is there a way to add the shapefileObject to 
the layer? (myLayer.data = myShapefileName didn't work).

Bye,

Bjoern.


-- 
small office solutions
info at sosnetz.de  -  http://www.sosnetz.de




More information about the mapserver-users mailing list