[Mapserver-users] Pan Button

Lars V. Nielsen LVN at gispro.dk
Sun Dec 15 05:19:41 EST 2002


Hi Jeff,

When you click on a submitting image (i.e. <input type=image..>), this pixel x and y coordinate of the click is returned. With the
map image this results in e.g. mapa_x and mapa_y being returned (when the name of the map image is "mapa"). But the same goes for
any image, including panning arrows, regardless of whether you're interested in the pixel coordinates or not.

In short, to determine if the image named "pan" has been clicked, test if "pan_x" (or "pan_y") is present among the posted values.
I.e.: if (isset("pan_x")) ... So first of all you need to give each arrow image a different name, e.g. "panNW", "panN" etc.

You may also do some JavaScript magic with OnClick and hidden fields, but the above is much simpler.

NOTE, that the exact format of the returned image coordinates are probably webserver dependent. The above description is from
Apache, but other webservers may use a different format.

Best regards/Med venlig hilsen
Lars V. Nielsen
GisPro, Denmark
http://www.gispro.dk/
http://hjem.get2net.dk/lars-online/
WGS84: 10.20'40"E 55.20'20"N
----- Original Message -----
From: "Jeff Berry" <jeffb at erlandsen.com>
To: "MapServer" <mapserver-users at lists.gis.umn.edu>
Sent: Friday, December 13, 2002 9:19 PM
Subject: [Mapserver-users] Pan Button


> I'm trying to create fixed pan buttons, (pan right, left, up, down).
> However, I just can't seem to get it working.  Below is the php code I've
> placed in the main php section of the my phtml file.  Also, I've listed the
> html for the "pan right" input button.  I'm just not sure what I'm doing
> wrong here.  The button refreshes the map but does not change the extent.
>
> PHP
> ----
> $xmax = $gpoMap->extent->{xmax};
> $xmin = $gpoMmap->extent->{xmin};
> $xinc = ($xmax - $xmin ) / 2;
> if ($pan=="right") {
> $gpoMap->setextent( ($xmin + $xinc), $ymin, ($xmax + $xinc), $ymax);
> }
>
> HTML
> ----
> <input type=IMAGE src="images/right.gif" width="15" height="35" name="pan"
> value="right" border=0 >
>
>
> Jeff Berry
> Erlandsen & Associates
> P.O. Box 2029
> Chelan, WA 98816
> (509) 682-4189
> jeffb at erlandsen.com
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list