Setting classindex of shape instances in MapScript

Holger Floerke floerke at DOCTRONIC.DE
Wed Dec 8 04:55:11 EST 2004


Hi there,

under which circumstances I can set the "classindex" attribute of a shape
instance from MapScript?

I tried to open an existing layer (from the mapfile definitions) with open,
iterate over the shapes (getShape) and use the shape->set("classindex",x)
method to dynamically assign a class (generated bythe script) to this
shape. After closing the layer the assignments are lost. The shapes do not
show the assigned styles and retrieving the shape again after the
close-method shows the old value.

After that dilemma I create a layer with MapScript, open the shape-file
with ShapeFileObj, iterate over the shapes, assings the
"classindex"-attribute and push the onto the layer with "addFeature". That
works, but I can't retrieve the associated values of the shape without
manually openign the dbf-file.

The goal is the color the shapes with the result of a complex computation.
I tried to add the results as a value to the shapes and let the expression
of the ClassObj choose the class, but I couldn't dynamically add some
values to the shapes of a layer with a datafile assigned.

Any ideas?

HolgeR



More information about the mapserver-users mailing list