Problem with call to zoomRectangle() function in Python mapscript

Sean Gillies sgillies at FRII.COM
Fri Aug 27 09:59:36 EDT 2004


On Aug 27, 2004, at 7:41 AM, Bill Hudspeth wrote:

> I am experiencing 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
> prevExtent =mapscript.rectObj(float(self.prev_minx),
> float(self.prev_miny), float(self.prev_maxx), float(self.prev_maxy))
> zoomRect=mapscript.rectObj(min(float(self.down_x), float(self.up_x)),
> min(float(self.down_y), float(self.up_y)), max(float(self.down_x),
> float(self.up_x)), max(float(self.down_y), float(self.up_y)))
> self.nmMap.zoomRectangle(zoomRect, int(self.img_width),
> int(self.img_height), prevExtent, prevExtent)
> **************************************
>
> The error I am receiving is:
> ****************
> General error message. Georeferenced coordinates miny <= maxy.
> ***********************
> This message is a little cryptic - would appreciate any ideas on where
> to go with it.
>
> Thanks, Bill
>

Bill,

Correction: as confusing as the error message is, your real problem
is with your pixel coordinate rectangle.  In image coordinates the
origin is upper left, with y increasing downwards.  Your up_y and
down_y values need to be flipped around.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list