<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use mapscript;
use XBase;

$county = 'Itasca';

$map = new mapObj(undef);

$layer = new layerObj($map);
$class = new classObj($layer);

$map-&gt;{width} = $map-&gt;{height} = 120;

# find the county
$shapefile = new shapefileObj("../data/ctybdpy2", -1) or die ('Unable to open county shapefile');
$table = new XBase "../data/ctybdpy2.dbf" or die XBase-&gt;errstr;
$shape = new shapeObj($mapscript::MS_POLYGON);

$i = 0;
$cursor = $table-&gt;prepare_select("CTY_NAME") or die XBase-&gt;errstr;
while (($name) = $cursor-&gt;fetch) {
  last if $name eq $county;
  $i++;
}

$shapefile-&gt;get($i, $shape);
$map-&gt;{extent} = $shape-&gt;{bounds};

# set up the layer
$layer-&gt;{name} = 'county';
$layer-&gt;{type} = $mapscript::MS_POLYGON;

# set up the class
$class-&gt;{color} = $map-&gt;addColor(225,225,185);
$class-&gt;{outlinecolor} = $map-&gt;addColor(128,128,128);

# draw the shape
$img = $map-&gt;prepareImage();
$shape-&gt;draw($map, $layer, $img, undef, undef);

# save the image
mapscript::msSaveImage($img, '../graphics/reference.gif', 1, 1);
mapscript::msFreeImage($img);

print "Use ". join(' ', ($map-&gt;{extent}-&gt;{minx}, $map-&gt;{extent}-&gt;{miny}, $map-&gt;{extent}-&gt;{maxx}, $map-&gt;{extent}-&gt;{maxy})) ." for reference extent.\n";
</pre></body></html>