<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Verdana"><small>Greetings people from Mapserver,</small><br>
<br>
&nbsp;&nbsp; </font>
<font face="Verdana" size="-1">I've been unsuccessfully trying to make </font><font
 face="Verdana" size="-1">mapObj.zoomRectangle </font><font
 face="Verdana" size="-1">work. My goal is to write a simple zoom by
rectangle, which lets you to select an image area from web browser and
submit those coordenates for zoom processing inside mapserver. Although
I've checked my code more than once, the error seems to be related to
the way mapserver deals with these coordenates. D</font><font
 face="Verdana" size="-1">o you know if there is any problem in
mapObj.zoomRectangle tool in Java Mapscript?&nbsp; </font><font
 face="Verdana" size="-1">How could I zoom to a specific
pixel location using zoomRectangle?</font><font face="Verdana"><br>
</font><font size="-1"><font face="Verdana"><br>
&nbsp; Suppose I have a map with the following size and extent :<br>
</font></font>
<blockquote><font size="-1"><font face="Verdana">&nbsp; SIZE 800 450</font></font><br>
  <font size="-1"><font face="Verdana">&nbsp; EXTENT -180.000000 -90.000000
180.000000 90</font></font><br>
</blockquote>
<font face="Verdana">&nbsp;&nbsp;
</font><font size="-1"><font face="Verdana">Here is my Java code : <br>
</font></font>
<blockquote><font size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">mapObj mapa = new
mapObj("./world.map");<br>
...<br>
rectObj maxExtent = new
rectObj(-180, -90, 180, </font></font></font><font size="-1"><font
 face="Verdana">90</font></font><font size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">, mapscript.MS_FALSE);&nbsp;&nbsp;&nbsp; //map
full extent<br>
  </font></font></font><font size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">rectObj actualExtent = new
rectObj(-120, -60, 160, </font>45</font></font><font size="-1"><font
 face="Verdana"><font face="Courier New, Courier, monospace">,
mapscript.MS_FALSE); //map actual extent</font></font></font><br>
  <font size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">rectObj pxArea = new
rectObj(170, 200, 270, 400, mapscript.MS_FALSE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //image
coordenates for zooming<br>
mapa.zoomRectangle(</font></font></font><font size="-1"><font
 face="Verdana"><font face="Courier New, Courier, monospace">pxArea</font></font></font><font
 size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">, mapa.getWidth(),
mapa.getHeight(), </font></font></font><font size="-1"><font
 face="Verdana"><font face="Courier New, Courier, monospace">actualExtent</font></font></font><font
 size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">, </font></font></font><font
 size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">maxExtent</font></font></font><font
 size="-1"><font face="Verdana"><font
 face="Courier New, Courier, monospace">);<br>
  </font></font></font></blockquote>
<font face="Verdana">&nbsp;&nbsp;
</font><font size="-1"><font face="Verdana">When I try to execute the
zoomRectangle command, the following exception is thrown :<br>
</font></font>
<blockquote><font face="Courier New, Courier, monospace"><small>java.lang.UnknownError:
mapscript::mapObj::zoomRectangle(): General error message. image
rectangle miny &gt;= maxy</small><br>
  </font></blockquote>
<blockquote>
  <pre><big><font face="Courier New, Courier, monospace">        edu.umn.gis.mapscript.mapscriptJNI.mapObj_zoomRectangle(Native Method)
        edu.umn.gis.mapscript.mapObj.zoomRectangle(mapObj.java:554)
        ...
</font></big></pre>
</blockquote>
<small><font face="Verdana">&nbsp;&nbsp;
By the way, what does the last param of rectObj constructor mean? Is </font></small><small><font
 face="Verdana">imageunits</font></small><small><font face="Verdana"> a
boolean to indicate whether coordenates are image-relative or
geographical values? If I try to set it to MS_TRUE I get a different
exception. <br>
<br>
</font></small>
<blockquote>
  <pre>java.lang.UnknownError: rectObj(): Invalid rectangle. image (pixel/line) units { 'minx': 248.000000 , 'miny': 194.000000 , 'maxx': 387.000000 , 'maxy': 259.000000 }
        edu.umn.gis.mapscript.mapscriptJNI.new_rectObj(Native Method)
        edu.umn.gis.mapscript.rectObj.&lt;init&gt;(rectObj.java:69)</pre>
</blockquote>
<br>
<font size="-1"><font face="Verdana">Could you please help me to solve
this situation?<br>
<br>
Best regards,<br>
<br>
</font></font>
<div class="moz-signature">-- <br>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title></title>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><font
 color="#000000" size="2"><b>Jos&eacute; Vilson de Mello de Farias</b> </font><br>
<font color="#606060"><i><big>Analista de Sistemas<br>
</big></i></font></font><i style="color: rgb(96, 96, 96);"><font
 size="-2">SSE - Seguran&ccedil;a P&uacute;blica</font></i><br>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><br>
<font color="#000080"><b>D&Iacute;GITRO TECNOLOGIA</b></font><br>
<font color="#000000"><b>E-mail:</b> </font><a
 href="mailto:vilson.farias@digitro.com.br%20"><font color="#606060">vilson.farias@digitro.com.br</font></a><br>
</font><font color="#000000" face="Verdana, Helvetica, Arial" size="1"><font
 color="#000000"><b>Messenger: </b></font></font><font color="#000000"
 face="Verdana, Helvetica, Arial" size="1"><a
 href="mailto:vilson.farias@digitro.com.br%20"><font color="#606060">vilsonfarias@hotmail.com</font></a></font><br>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><!--<font color = #000000> <b>ICQ:</b></font>
<font color = #000000> 11866179</font><br>
!--><font
 color="#000000"><b></b></font><font color="#000000"><b>Site:</b></font>
<a href="http://www.digitro.com.br%20"><font color="#000000">www.digitro.com.br</font></a><a
 href="http://www.digitro.com.br%20"> </a></font>
</div>
</body>
</html>