#!/usr/bin/perl -w
use warnings;
use strict;
use mapscript;

gen_map('zoom_in.png', 4000000);
gen_map('zoom_out.png', 6000000);

sub gen_map {
	my($out_fn, $range) = @_;
	unlink $out_fn if -e $out_fn;
	my $map = new mapscript::mapObj('cascade.map') or die('Unable to open mapfile.');
	#$map->setProjection('proj=qsc,face=0,a=4000000');
	$map->setProjection('proj=ortho,lon_0=-147.84944,lat_0=64.85944');
	my $rect= new mapscript::rectObj();
	$rect->{minx} = $rect->{miny} = -$range;
	$rect->{maxx} = $rect->{maxy} =  $range;
	$map->{extent} = $rect;
	$map->{width} = 800;
	$map->{height} = 800;
	$map->{debug} = 1;
	my $img = $map->draw() or die('Unable to draw map');
	$img->save($out_fn);
	-e $out_fn or die 'Unable to save map';
}
