[mapserver-users] returning mouse click coordinates with PHP

Jan Mantkowski jan.mantkowski at gmx.de
Fri Mar 29 17:50:46 EST 2002


Hi Scott,

try

<?php echo "X= ".$HTTP_POST_VARS["click_x"]." Y=
".$HTTP_POST_VARS["click_y"]."<BR>" ?>

It should do the trick.

Have a look at
http://mapserver.gis.umn.edu/doc/phpmapscript-byexample-howto.html

for demo scripts.
Example 2 should be OK for your needs.

Jan




-----Original Message-----
From: owner-mapserver-users at lists.gis.umn.edu
[mailto:owner-mapserver-users at lists.gis.umn.edu]On Behalf Of Scott D
Cogan
Sent: Friday, March 29, 2002 9:48 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] returning mouse click coordinates with PHP


OK, so i have my map being displayed with PHP and Mapscript calls now.  the
initial map is displayed fine, however I can't figure out how to make it
"clickable" so that I can find out which coordiniates have been clicked on.
any ideas?  also pretty soon i am going to want to do more, like panning,
zooming, etc, with PHP.  are there any good demo PHP scripts available to
learn from?  here is my testing.php file:
thanks!
-scott


<?php

$map_path="C:\\Program Files\\Apache\\htdocs\\mich\\";
$map = ms_newMapObj($map_path."demo.map");
$image=$map->draw();
$image_url=$image->saveWebImage(MS_GIF,1,1,0);

?>
<HTML><HEAD><TITLE>Map 1</TITLE></HEAD>
<BODY>
  <center>
  <?php echo "X=$click_x and Y=$click_y<BR>" ?>
  <TABLE border=1>
  <TR><td>
    <a href="<?php echo $PHP_SELF ?>">
    <INPUT TYPE=IMAGE NAME=click BORDER=0 SRC=<?php echo $image_url?>
WIDTH=600 HEIGHT=600 >
    </a>
  </td></TR>
  </TABLE>
  <center>
</BODY>
</HMTL>






More information about the mapserver-users mailing list