Continuing problem with rectObj creation in python mapscript

Bill Hudspeth bhudspeth at EDAC.UNM.EDU
Mon Aug 30 13:55:28 EDT 2004


I am using Mapserver 4.3.1 andI am continuing to experience an unknown
problem with a call to the map object
zoomRectangle() function in Python mapscript. My code looks like this:
*************************************
self.nmMap = mapscript.mapObj()
self.img_width = self.nmMap.width
self.img_height = self.nmMap.height

self.prev_minx=45726.60           #utm coords
self.prev_miny=3400000.0         #utm coords
self.prev_maxx=785072.39         #utm coords
self.prev_maxy=4153198.0         #utm coords

self.down_x=240                         #pixel coords
self.up_x=330                              #pixel coords
self.down_y=145                         #pixel coords
self.up_y=208                              #pixel coords

#create rect object with current utm coords
prevExtent =mapscript.rectObj(float(self.prev_minx),
float(self.prev_miny), float(self.prev_maxx), float(self.prev_maxy))

#create rect object from mouse clicks (pixels)
pix_minx=12.0
pix_miny=17.0
pix_maxx=123.0
pix_maxy=155.0
zoomRect=mapscript.rectObj(pix_minx, pix_miny, pix_maxx, pix_maxy)

self.nmMap.zoomRectangle(zoomRect, int(self.img_width),
int(self.img_height), prevExtent, prevExtent)

**************************************
The error traces back to:
zoomRect=mapscript.rectObj(pix_minx, pix_miny, pix_maxx, pix_maxy)

REGARDLESS of the values I enter into pix_minx, pix_miny, pix_maxx, and
pix_maxy, I get the following error.

General error message. Invalid bounds

Given that pixel coordinates on images reverse the directionality of
increases in the y axis, I have tried all possible combinations of
values for these four variables just as a test; (minx, miny, maxx, maxy)
i.e.
(12.0, 23.0, 147.0, 153.0)
(12.0, 153.0, 147.0, 23.0)
(147.0, 23.0, 12.0, 153.0)
(147.0, 153.0, 12.0, 23.0)


***********************
I would very much appreciate any help on this.

Bill



More information about the mapserver-users mailing list