Python mapscript zoomrectangle
William Hudspeth
bhudspeth at EDAC.UNM.EDU
Fri Jan 7 08:34:28 PST 2005
I am using Mapserver 4.2, and Python Mapscript revision 1.4.2.1. As I
wrote recently, I have written some code to pass pixel values from a
user-selected rectangle to Zoomrectangle. Sean Gillies made changes to
the Python Mapscript code to handle pixel values and make the
appropriate conversions (with an additional flag to the rectObj
constructor). He also suggested a workaround for the older Mapscript
version that I am using. It involved directly assigning pixel values to
a rectObj:
#pixel values passed in
x_min=289 (left)
y_min=78 (top)
x_max=450 (right)
y_max=201 (bottom)
zoomRect=mapscript.rectObj()
zoomRect.minx, zoomRect.miny, zoomRect.maxx, zoomRect.maxy=
(minx,maxy,maxx,miny)
self.mapObj.zoomRectanlge(rectObj, width, height, rectObj, rectObj)
This solution worked well for maps in a UTM coordinate system with a
"normal" cartesian layout (e.g. x increases to the right, y increases to
the north). However, my current map is in geographic coordinates with
approximate borders north=44N south=27N west=125W (or -125) east=93W (or
-93) - e.g. x values increase to the left. The same code that worked
with UTM's is not working with Geographic coords. Hence my interest on a
workaround for this particular problem, or whether it would be easier to
upgrade the version of Mapscript.
Bill
More information about the MapServer-users
mailing list