MapScript: Altering classes

Michael Anderson m_anderson14 at hotmail.com
Fri Jul 28 10:45:54 EDT 2000


Hello,

I am trying to change the classification of a layer using MapScript. I 
change the colors in an existing classes with no problems, but if I try to 
set a new classitem and create new classes I get a segmentation error. Here 
is my code.

map = mapObj("soils.map")
soilsL = map.getLayerByName('soils')
soilsL.classitem = 'Hydric_c'
cl0 = classObj(soilsL)
cl1 = classObj(soilsL)
green = map.addColor(0,255,0)
blue = map.addColor(0,0,255)
black = map.addColor(0,0,0)
cl0.expression = 'N'
cl1.expression = 'Y'
cl0.color = green
cl1.color = blue
cl0.outlinecolor = black
cl1.outlinecolor = black
soilsL.status = 1
img = map.prepareImage()
soilsL.draw(map,img)
Segmentation fault -- kicked out of Python.

I checked along the way to make sure my variables are referencing valid 
objects and everything looks OK. Can someone tell what I am doing wrong. I 
am guessing it has something to do with the expression, but it's only a 
guess. I can post a Perl version, but I think Python's syntax is clear 
enough to express what I am trying to do.

Thanks,
Mike
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




More information about the mapserver-users mailing list