mapObj.zoomRectangle from Java Mapscript.
José Vilson de Mello de Farias
vilson.farias at DIGITRO.COM.BR
Wed Dec 6 11:30:35 PST 2006
Greetings people from Mapserver,
I've been unsuccessfully trying to make mapObj.zoomRectangle 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. Do you know if there is any problem in
mapObj.zoomRectangle tool in Java Mapscript? How could I zoom to a
specific pixel location using zoomRectangle?
Suppose I have a map with the following size and extent :
SIZE 800 450
EXTENT -180.000000 -90.000000 180.000000 90
Here is my Java code :
mapObj mapa = new mapObj("./world.map");
...
rectObj maxExtent = new rectObj(-180, -90, 180, 90,
mapscript.MS_FALSE); //map full extent
rectObj actualExtent = new rectObj(-120, -60, 160, 45,
mapscript.MS_FALSE); //map actual extent
rectObj pxArea = new rectObj(170, 200, 270, 400,
mapscript.MS_FALSE); //image coordenates for zooming
mapa.zoomRectangle(pxArea, mapa.getWidth(), mapa.getHeight(),
actualExtent, maxExtent);
When I try to execute the zoomRectangle command, the following
exception is thrown :
java.lang.UnknownError: mapscript::mapObj::zoomRectangle(): General
error message. image rectangle miny >= maxy
edu.umn.gis.mapscript.mapscriptJNI.mapObj_zoomRectangle(Native Method)
edu.umn.gis.mapscript.mapObj.zoomRectangle(mapObj.java:554)
...
By the way, what does the last param of rectObj constructor mean? Is
imageunits 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.
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.<init>(rectObj.java:69)
Could you please help me to solve this situation?
Best regards,
--
*José Vilson de Mello de Farias*
/Analista de Sistemas
//SSE - Segurança Pública/
*DÍGITRO TECNOLOGIA*
*E-mail:* vilson.farias at digitro.com.br
<mailto:vilson.farias at digitro.com.br%20>
*Messenger: *vilsonfarias at hotmail.com
<mailto:vilson.farias at digitro.com.br%20>
***Site:* www.digitro.com.br <http://www.digitro.com.br%20>
<http://www.digitro.com.br%20>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061206/40969a9d/attachment.htm>
More information about the MapServer-users
mailing list