Problems with Python Mapscript Zoomrectangle function

William Hudspeth bhudspeth at EDAC.UNM.EDU
Mon Dec 20 10:33:37 PST 2004


Hello,

I am using Mapserver 4.2, and Python Mapscript revision 1.4.2.1. I have
written some code to pass pixel values from a user-selected rectangle to
Zoomrectangle. My underlying map is in geographic coordinates with
approximate borders north=44N south=27N west=125W (or -125) east=93W (or
-93). I have used the code successfully with UTM coordinates, but am
having trouble with negative DD values. My code is:

#pixel values passed in
x_min=289
y_min=78
x_max=450
y_max=201

prevExtent=mapscript.rectObj(minx,miny,maxx,maxy)#default x and y limits
of mapfile
zoomRect=mapscript.rectObj()
zoomRect.minx, zoomRect.miny, zoomRect.maxx, zoomRect.maxy = (minx,
miny, maxx, maxy)
self.map.zoomRectangle(zoomRect, int(self.img_width), int
(self.img_height), prevExtent, prevExtent)

**I have tried reversing the miny and maxy values where I assign them to
the zoomRect.* variables. Any help appreciated.

Bill



More information about the MapServer-users mailing list