From: Dobrica Pavlinusic Date: Sat, 2 Apr 2011 14:06:52 +0000 (+0000) Subject: copied files for koha publisher geolocation X-Git-Url: http://git.rot13.org/?p=google-map-tiles.git;a=commitdiff_plain;h=2e276e44979693e2e64d00b2a83eff9053fa7133 copied files for koha publisher geolocation --- diff --git a/koha.html b/koha.html new file mode 100644 index 0000000..7bbc536 --- /dev/null +++ b/koha.html @@ -0,0 +1,155 @@ + + + + + + + World Volcanoes + + + + +
+
+ + + diff --git a/koha.pl b/koha.pl new file mode 100755 index 0000000..adce9df --- /dev/null +++ b/koha.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl +# Deliver click values to volcano.htm... +# Author. John D. Coryat 02/2010... +# Copyright 2010 USNaviguide LLC. All rights reserved... + +use CGI qw/:standard *table/; +use strict ; +use DBI ; +use USNaviguide_Google_Tiles ; + +my $dbh = DBI->connect ( "dbi:Pg:dbname=volcano" , "" , "" , { AutoCommit => 1 } ) ; +my $point = param('POINT') ; +my $zoom = param('ZOOM') ; + +my $lat = 0 ; +my $lng = 0 ; +my $latpix = 0 ; +my $lngpix = 0 ; + +my $volpnt = '' ; +my $vlat = 0 ; +my $vlng = 0 ; +my $vlatpix = 0 ; +my $vlngpix = 0 ; + +my $value = '' ; +my $maxpix = 15 ; # Maximum pixels between click and point +my $name = '' ; +my $descript = '' ; +my $x = '' ; +my $i = 0 ; + +print header('text/xml'); +print qq{\n} ; +print qq!\n! ; + +if ( !$point ) +{ + print qq!\n! ; + print qq!\n! ; + $dbh->disconnect ; + exit ; +} + +if ( $point =~ /(.*),(.*)/ ) +{ + $lat = $1 ; + $lng = $2 ; + + $value = &Google_Tile_Factors($zoom) ; # Calculate Tile Factors + + ($latpix,$lngpix) = &Google_Coord_to_Pix( $value, $lat, $lng ) ; # Convert coordinate to pixel location + + $x = "select name,descript,volpnt,point'($lat,$lng)' <-> volpnt as distance from gvp_world order by distance limit 1" ; + + if ( ($name,$descript,$volpnt,$i) = $dbh->selectrow_array($x) ) # Got one + { + $volpnt =~ /\((.*),(.*)\)/ ; + $vlat = $1 ; + $vlng = $2 ; + + ($vlatpix,$vlngpix) = &Google_Coord_to_Pix( $value, $vlat, $vlng ) ; # Convert coordinate to pixel location + + if ( sqrt(($vlatpix - $latpix)**2 + ($vlngpix - $lngpix)**2) > $maxpix ) + { + # Click not within maxpix of point... + print qq!\n! ; + } else # Good point found + { + print qq!\n! ; + print qq! <\![CDATA[$descript]]>\n! ; + print qq!\n! ; + } + } +} else +{ + print qq!\n! ; +} +$dbh->disconnect ; + +print "\n\n" ; +