[Mapserver-users] Demo app for perl mapscript
Jon Shorie
jshorie at medinaco.org
Mon Mar 10 05:54:24 PST 2003
Does anybody have a simple demo for perl mapscript that supports navigation?
For example zooming in and panning.
So far, I have gotten the simple demo to work that just renders a map file and
then displays it. Now, I need to get some navigation working.
Here is what I have so far:
#!/usr/bin/perl
use mapscript;
use CGI qw(:standard :html escape);
$headingfile = "/var/www/cgi-bin/mcsegis/heading.csv";
$ENV{MS_ERRORFILE} = "/var/www/cgi-bin/mcsegis/mapsrv.log";
print "Content-type: text/html\n\n";
#################################
# Get Heading from Heading File #
# and print it #
#################################
open (HEADING,$headingfile) or die "Can't open data file: $!\n";
@HEADING=<HEADING>;
close (HEADING);
foreach $line(@HEADING)
{
chomp($line);
print "$line \n";
}
$imageid = time() . '.png';
$imagefilespec = '/mcse3b/' . $imageid;
print "saving image $imageid";
##############
# Render Map #
##############
my $map = new mapObj('/var/www/html/mcse3b/mcse.map') or
die('Unable to open mapfile.');
my $img = $map->draw() or die('Unable to draw map');
my $void = $img->saveImage($imageid, $mapscript::MS_PNG, $map->{transparent},
$map->{interlace}, 0);
print "<img src='$imagefilespec'>";
More information about the MapServer-users
mailing list