Odd issue with drawing a shape multiple times

Steve Lime steve.lime at DNR.STATE.MN.US
Tue Mar 1 13:09:39 EST 2005

The likely problem is that the shape is being altered when drawn. I
believe the
shape coordinates are converted from map coordinates to image
in place, and then clipped and thinned. The thinking pre-dates
MapScript and
was done that way to avoid ton's of coordinate copying.

To fix? Make a copy of the shape in the draw methods and hand that copy
to be rendered leaving the original intact.


>>> Sean Gillies <sgillies at FRII.COM> 3/1/2005 10:29:30 AM >>>
Can anyone share their insight into shape rendering with me?  I'm
finding it impossible to redraw a single shape using the same map and
layer objects using shapeObj.draw (and msDrawShape).  Is there some
caching or other magic at work here that's tripping me up?

The script is run from mapserver/tests:

     import mapscript

     mo = mapscript.mapObj('test.map')

     # Use the POLYGON layer to render feature
     lo = mo.getLayerByName('POLYGON')

     # Get one polygon shape
     so = lo.getFeature(0)

     so.classindex = 0

     def inspect_shape(so):
         for item in dir(so):
             print item, getattr(so, item)

     # render the shape
     im = mo.prepareImage()
     print "p1a\n---\n"
     so.draw(mo, lo, im)

     # render the shape in a new image
     im = mo.prepareImage()
     print "p1b\n---\n"
     so.draw(mo, lo, im)

Produces the images

p1a (is correct):

More information about the mapserver-dev mailing list