[mapserver-users] Problem setting name attribute of classObj with Python Mapscript
Sean Gillies
sgillies at i3.com
Fri Apr 19 13:28:23 PDT 2002
Have any Python (or other) Mapscript users found trouble with
setting the "name" attribute of a classObj? I've been through
the list archives but haven't found anything of help.
In short, I'm unable to set the name attribute of a classObj
by statements like
myclass.name = "FOO"
Am using Python Mapscript built from the 3.5 Win32 distribution.
Here is the relevant code of my script. Am looping over several
layers in a list and ftab['name'] is bound to a different value
each time.
...
class_OK = classObj(layer)
class_OK.setExpression("/1/")
class_OK.name = ftab['name'] + "_OK"
class_OK.outlinecolor = purple # 255,0,255
class_DEF = classObj(layer)
class_DEF.name = ftab['name'] + "_DEF"
class_DEF.color = red
class_DEF.outlinecolor = purple
class_DEF.label.color = black
class_DEF.label.type = MS_BITMAP
class_DEF.label.size = MS_TINY
class_DEF.label.position = MS_CC
class_DEF.label.force = MS_TRUE
...
map.save(...)
The map is drawn and looks fine, but no legend. Examining the
map file that was written, I see that everything is in its
place except that there is no NAME for either of the two classes
I've defined for every layer. Here is an excerpt from the map
file:
CLASS
EXPRESSION /1/
MAXSIZE 100
MINSIZE 1
OUTLINECOLOR 255 0 255
SIZE 1
SYMBOL 0
END
CLASS
COLOR 255 0 0
LABEL
SIZE TINY
TYPE BITMAP
BUFFER 0
COLOR 0 0 0
FORCE TRUE
MINDISTANCE -1
MINFEATURESIZE -1
OFFSET 0 0
PARTIALS TRUE
POSITION CC
END
MAXSIZE 100
MINSIZE 1
OUTLINECOLOR 255 0 255
SIZE 1
SYMBOL 0
END
Am stumped and grateful for any suggestions.
thanks,
Sean
--
Sean Gillies Applications Developer
i-cubed : information integration & imaging LLC
970-482-4400 voice
970-482-4499 fax http://www.i3.com
More information about the MapServer-users
mailing list