View Full Version : Clicking on maps and obtaining coordinates
rick-k
10-30-2006, 05:45 PM
I want to know how to make a map that a web site visitor can click on to input his location. Then a server script will use that information to calculate something (eclipse visibility, sunrise time, etc.). It seems that ought to be not too far away from an ISMAP function.
Rick Koshko
rick-k
11-02-2006, 06:27 PM
Never mind. I figured it out.
The HTML is just like calling any ISMAP but with a .cgi call instead of a .map call:
<A HREF="/cgi-bin/clickmap.cgi"><IMG SRC="/worldmap.jpg" ISMAP></A>
And the script that deals with it is:
#!/usr/local/bin/perl
print "Content-Type: text/html\n\n";
print "<HEAD><TITLE>Clickmap Example Page</TITLE></HEAD>\n";
print "<BODY>\n";
($clicked_x, $clicked_y) = split(/,/,$ENV{QUERY_STRING});
print "x=", $clicked_x, " y =", $clicked_y, "<BR>\n";
I was using the wrong environmental variable before. Of course, the above snippet is just the start. X and Y will be converted to latitude and longitude and the other info will be included in the script to make the necessary calculations.
Rick Wiegmann Koshko
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.