#!/usr/bin/perl use CGI; use Imager; use Imager::Fill; use Geo::Dymaxion; # available from CPAN, requires Inline.pm use strict; use warnings; my $image_file = "dymaxion.jpg"; my $cities_file = "cities.txt"; my $dot_color = "red"; my $dot_size = 3; $|++; my $cgi = CGI->new; my %var = $cgi->Vars; if ($var{img}) { my $map = Imager->new; $map->open( file => $image_file ); my $type = $map->type; print $cgi->header("image/jpeg"); my $dymax = Geo::Dymaxion->new( $map->getwidth, $map->getheight ); my ($x, $y) = $dymax->plot( $var{lat}, $var{long} ); $map->circle( color => "white", r => $dot_size + 1, x => $x, y => $y ); $map->circle( color => $dot_color, r => $dot_size, x => $x, y => $y ); $map->write( type => "jpeg", fd => fileno(STDOUT) ) or die $map->errstr; } else { my $this = $cgi->url; print $cgi->header; print qq{
Population Centers across the Earth