[mapserver-users] zoom in problem, PHP, winnt

Assefa Yewondwossen assefa at dmsolutions.ca
Wed Apr 17 14:01:22 EDT 2002


Hi There,

 I just tested your code (using my own map file) and things seems to be working properly whne zooming in. So there seems to be no problem with the code here.
 I am assuming it might be related to your map file, so If you send me your map file and some sample data, I can do a test and let you know how it goes.

Best Regards

Debbie Pagurek wrote:

> Hi,
>  I have been starting to use php/mapscript and have had some success although right now I have a frustrating problem with the following code.  I took the php/mapscript example that uses a map of Europe and I substituted my own map of Canada, in decimal degrees.  The pan and zoom out work fine, but the zoom in results in my browser just sitting there spinning its wheels.  In my map file, the extent is set to: EXTENT -145.0 40.0 -50.0 85.0 and SIZE is set to 600 284.
>
> Can anyone see what is wrong that would cause zoom in to fail?  I get no error messages, and eventually PHP responds with a time out message.
>
> Below is my code.
>
> Thanks,
> D. Pagurek
>
> <?php
> dl("php_mapscript_35.dll");
>
> // Default values and configuration
> $val_zsize=3;
> $check_pan="CHECKED";
> $map_path="";
> $map_file="feat.map";
>
> $map = ms_newMapObj($map_path.$map_file);
>
> if ( isset($HTTP_POST_VARS["mapa_x"]) && isset($HTTP_POST_VARS["mapa_y"]) && !isset($HTTP_POST_VARS["full"]) ) {
>
>         $extent_to_set = explode(" ",$HTTP_POST_VARS["extent"]);
>
>         $map->setextent($extent_to_set[0],$extent_to_set[1],$extent_to_set[2],$extent_to_set[3]);
>
>         $my_point = ms_newpointObj();
>         $my_point->setXY($HTTP_POST_VARS["mapa_x"],$HTTP_POST_VARS["mapa_y"]);
>
>         $my_extent = ms_newrectObj();
>
>         $my_extent->setextent($extent_to_set[0],$extent_to_set[1],$extent_to_set[2],$extent_to_set[3]);
>
>         $zoom_factor = $HTTP_POST_VARS["zoom"]*$HTTP_POST_VARS["zsize"];
>         if ($zoom_factor == 0) {
>                 $zoom_factor = 1;
>                 $check_pan = "CHECKED";
>                 $check_zout = "";
>                 $check_zin = "";
>         } else if ($zoom_factor < 0) {
>                 $check_pan = "";
>                 $check_zout = "CHECKED";
>                 $check_zin = "";
>         } else {
>                 $check_pan = "";
>                 $check_zout = "";
>                 $check_zin = "CHECKED";
>         }
>
>         $val_zsize = abs($zoom_factor);
>
>         $map->zoompoint($zoom_factor,$my_point,$map->width,$map->height,$my_extent);
>
> }
>
> $image=$map->draw();
> $image_url=$image->saveWebImage(MS_PNG,1,1,0);
>
> $extent_to_html = $map->extent->minx." ".$map->extent->miny." ".$map->extent->maxx." ".$map->extent->maxy;
>
> ?>
> <HTML>
> <HEAD>
> <TITLE>Butterflies of Canada </TITLE>
> </HEAD>
> <BODY>
> <CENTER>
> <H2><?php echo $taxon ?></H2>
>
> <FORM METHOD=POST ACTION=<?php echo $PHP_SELF?>>
> <INPUT TYPE="HIDDEN" NAME="taxon" VALUE="<?php echo $taxon?>">
> <TABLE>
> <TR>
>         <TD>
>                 <INPUT TYPE=IMAGE NAME="mapa" SRC="<?php echo $image_url?>">
>         </TD>
> </TR>
> <TR>
>         <TD>
>                 Pan
>         </TD>
>         <TD>
>                 <INPUT TYPE=RADIO NAME="zoom" VALUE=0 <?php echo $check_pan?>>
>         </TD>
> </TR>
> <TR>
>         <TD>
>                 Zoom In
>         </TD>
>         <TD>
>                 <INPUT TYPE=RADIO NAME="zoom" VALUE=1 <?php echo $check_zin?>>
>         </TD>
> </TR>
> <TR>
>         <TD>
>                 Zoom Out
>         </TD>
>         <TD>
>                 <INPUT TYPE=RADIO NAME="zoom" VALUE=-1 <?php echo $check_zout?>>
>         </TD>
> </TR>
> <TR>
>         <TD>
>                 Zoom Size
>         </TD>
>         <TD>
>                 <INPUT TYPE=TEXT NAME="zsize" VALUE="<?php echo $val_zsize?>" SIZE=2>
>         </TD>
> </TR>
> <TR>
>         <TD>
>                 Full Extent
>         </TD>
>         <TD>
>                 <INPUT TYPE=SUBMIT NAME="full" VALUE="Go" SIZE=2>
>         </TD>
> </TABLE>
> <INPUT TYPE=HIDDEN NAME="extent" VALUE="<?php echo $extent_to_html?>">
> </FORM>
> </CENTER>
> <a href="http://pagureknt/php/butterfly/examplestart.php">Change taxon</a>
> </BODY>
> </HMTL>
>

--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------





More information about the mapserver-users mailing list