[Mapserver-users] Setting the classindex of a shapeObj() has no effect
Bjoern Platzen
bplatzen at sosnetz.de
Tue Nov 18 15:36:55 PST 2003
Hi folks,
I'm still messing around with PythonMapScript...
With a lot of help from the list, I am now able to create queryable
Features for a layer. Now I want to show my points with different
symbols. In my database-table, Ive got a field for a category. If the
category-field contains '1', the point should be drawn with the CLASS
0, otherwise with CLASS 1.
Here's the layer-definition in the mapfile:
LAYER
NAME 'baustellen'
TYPE POINT
STATUS on
CLASS
Symbol 'bau'
END#class
CLASS
Symbol 'db'
END#class
TEMPLATE 'rahmen2.html'
TOLERANCE 50
END#LAYER
END # Map File
Here's the code-snippet, that produces the points:
for l in r[1]:
#r[1] is the resultset[[pointx,pointy,date1,date2,category],[..],..]
newPoint = mapscript.pointObj()
newPoint.x = l[0]
newPoint.y = l[1]
newLine = mapscript.lineObj()
newLine.add(newPoint)
newShape = mapscript.shapeObj(mapscript.MS_SHAPE_POINT)
newShape.add(newLine)
newShape.index=l[6]
if l[4]=='1':#l[4] contains the category
newShape.classindex = 0
else:
newShape.classindex = 1
myLayer.addFeature(newShape)
All features are displayed with the symbol defined in CLASS 0.
I thought classindex would be an attribute of the shapeObj() that is
read- and writeable.
What will I have to do to display my Points with different
symbols/classes??
Thanks in advance for any help!
Bye,
Bjoern
--
small office solutions
info at sosnetz.de - http://www.sosnetz.de
More information about the MapServer-users
mailing list