Hi, The rendering code could be reassigning the classindex for the shapes based on their attributes. You will probably need to make sure the CLASS is assigned based on an attribute of the feature - e.g. add a CLASSITEM to the layer and add a value to the feature that will match the correct CLASS.
Seth -- web:https://geographika.net & https://mapserverstudio.net twitter: @geographika On Sun, Oct 15, 2023, at 3:12 PM, Worth Lutz via MapServer-users wrote: > HI, > > I'm trying to create a layer to insert into a map. I have shapes in WKT and > am trying to insert them into a layer and draw it to a pdf. > > It works fine if I only have one class for the shapes. I am trying to add > several classes to the layer to draw in different colors. I cannot get the > shapes to use the proper class. > > Here is what I'm doing. > > After creating a layer and adding all the classes, I add the shapes. >> for (i = 0, ii = count($features); $i < $ii; i++) { >> $shape = ms_shhapeObjFrom Wkt($features[$i]->geometry); >> $shape->set('classindex', $features[$i]->classindex); >> $success = $layer->addFeature($shape); >> } > The shapes draw but all use $class[0]. > > If I add this line in before the draw, > > $layer-moveclassup(1); > > all the shapes are drawn with that class. > > I have been able to verify that the classes exist in the layerObj and that > the classindex in the shapeObj points to the proper class. > > Does anyone have any ideas why the drawing code is not using the classindex > to draw these shapes in different colors? > > What am I doing wrong? > > -- > *Worth Lutz* > > _______________________________________________ > MapServer-users mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/mapserver-users >
_______________________________________________ MapServer-users mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/mapserver-users
