[ms4w-users] Parsing Error in Zooming Script
Charu Verma
charu24 at gmail.com
Mon Mar 21 00:29:36 EST 2005
My mapfile is noname.map
I tried running the following script but it always gives me this
parsing error on line 9.i have checked evverything but am still not
able to figure out where the problem lies.Please help me.
Here's my code for zooming and panning:
<?php
dl('php_mapscript_42.dll');
$val_zsize=3;
$check_pan="CHECKED";
$map_path="C:\ms4w\Apache\htdocs\" ;
$map_file="NONAME.map";
$map=ms_newMapObj($map_path.$map_file) ;
if ( isset($HTTP_POST_VARS["noname_x"]) && isset($HTTP_POST_VARS["noname_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["noname_x"],$HTTP_POST_VARS["noname_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();
$extent_to_html = $map->extent->minx." ".$map->extent->miny." "
.$map->extent->maxx." ".$map->extent->maxy;
?>
<HTML>
<HEAD>
<TITLE>Map 2</TITLE>
</HEAD>
<BODY>
<CENTER>
<FORM METHOD=POST ACTION=<?php echo $HTTP_SERVER_VARS['PHP_SELF']?>>
<TABLE>
<TR>
<TD>
<INPUT TYPE=IMAGE NAME="noname" 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>
</BODY>
</HMTL>
More information about the ms4w-users
mailing list