[Mapserver-users] 4.x mapscript python styleObj question

Heitzso heitzso at growthmodels.com
Thu Jul 31 13:06:22 PDT 2003


(Not sure this went through on first pass, I apologize
if it is a double submittal.  Also, 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.  The layer
I'm building up is based on a layer that works great
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