[Mapserver-users] python styleObj classObj colorObj question in 4.x

Heitzso heitzso at growthmodels.com
Thu Jul 31 12:42:24 PDT 2003


(I'm working with cvs mapserver_dev from a couple
weeks ago.  Let me know please if that's my problem.)

Trying to create a layer to display in python mapscript.
I have the code working great with existing layers from
the map file.  But failing to draw layers created in
code.  The map will draw (when I don't have the code
buggered with experiments) but nothing shows.  I assumed
I don't have the outline color set correctly.  The layer
I'm building up is based on a layer that works when
accessed from the mapfile.  Code snippet ...
     map = mapObj(mapFilename)
     ...
     img = map.prepareImage()
     layer = layerObj(map)
     layer.name = 'test'
     layer.connection = "a postgis conn that works in mapfile"
     layer.connectiontype = MS_POSTGIS
     layer.data = "the_geom from counties"
     layer.status = MS_ON
     layer.type = MS_LAYER_POLYGON
     c = classObj(layer)
     c.name = "testclass"
     style = styleObj(c)               <-- CRASH!!!!!!!!!
     style.outlinecolor = setRGB(0,0,0)
     c.status = MS_ON
     layer.draw(map, img)
     map.drawLabelCache(img)
     img.save(imagePath + imageFilename)

I find doc confusing, cross ups between 3.x and 4.x
version and perl/php/python variations in code style
and doc version.

For instance ...

     doc states styleObj constructed with classObj
     passed in, i.e. 's = styleObj(cObj)' but
     mapscript complains that method must not have
     an argument ?!

     doc also states that everything migrated over
     to styleObj but it's not clear if that's
     _required_ or suggested

Could someone enlighten me?

THANKS!
Heitzso




More information about the MapServer-users mailing list