Reference Map

Eduardo Zenaide ezenaide at GMAIL.COM
Tue Jan 9 15:05:29 EST 2007


Ian,

i've put your code on a php file wich i included on my template and add
name=KEYMAP on my input. like:
<input type="image" src="[ref]" name="KEYMAP" />

didn't work. what i'm missing?

2007/1/9, Ian Tidy <IANT at napier.govt.nz>:
>
>  Sorry,  I didn't read your message properly.
>
> To get the keymap to pan, you need some code in your web page.
>
> My KEYMAP name is KEYMAP and the code to pan is something like this (PHP
> code):
>
> // Key Map
>     if ($_POST["KEYMAP_x"]) {
>
>      $dfKeyMapXMin = $map->reference->extent->minx;
>      $dfKeyMapYMin = $map->reference->extent->miny;
>      $dfKeyMapXMax = $map->reference->extent->maxx;
>      $dfKeyMapYMax = $map->reference->extent->maxy;
>
>      // Click Position
>      $nClickPixX = ($_POST[KEYMAP_x]);
>         $nClickPixY = ($_POST[KEYMAP_y]);
>
>         $dfWidthPix = doubleval($_POST[KEYMAPXSIZE]);
>         $dfHeightPix = doubleval($_POST[KEYMAPYSIZE]);
>
>   // Convert to a Geographic Co-Ordinate
>   $geoWidth = ($dfKeyMapXMax - $dfKeyMapXMin) / $dfWidthPix;
>   $geoHeight = ($dfKeyMapYMax - $dfKeyMapYMin) / $dfHeightPix;
>   $keymap_x = ($nClickPixX * $geoWidth) + $dfKeyMapXMin;
>   $keymap_y = $dfKeyMapYMax - ($nClickPixY * $geoHeight);
>
>   // Set Map Extents
>   $mapext_x = ($map->extent->maxx - $map->extent->minx) / 2;
>   $mapext_y = ($map->extent->maxy - $map->extent->miny) / 2;
>   //$my_extent = ms_newrectObj();
>   //$my_extent->setextent($keymap_x - $mapext_x,$keymap_y - $mapext_y,
> $keymap_x + $mapext_x,$keymap_y + $mapext_y);
>   $map->setExtent($keymap_x - $mapext_x,$keymap_y - $mapext_y, $keymap_x +
> $mapext_x,$keymap_y + $mapext_y);
>   $keymap_text = "<!-- KEYMAP CLICK=".$nClickPixX.", ".$nClickPixY."
> GEO=".$keymap_x.", ".$keymap_y." -->";
>     }
> There is a small bug in this code that I am still working on.
>
> Hope this helps.
>
> Cheers Ian
>
>  ------------------------------
> **
>


-- 
Eduardo Zenaide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070109/7fb0bc0d/attachment.html


More information about the mapserver-users mailing list