#!/usr/bin/perl -w # the first argument is the maximum extent in map units # divide by a resonable number of annotations per edge $x = $ARGV[0] / 10; print round_up($x) , "\n"; # round to a resonable scale # found at: # http://www.perlmonks.org/?node_id=599865 sub round_up { my $n = shift; my $scale = 10**int(log($n)/log(10)); $n = 9 if $scale == 1; #magic for single digits if ($n > $scale) { $n = int($n/$scale+1)*$scale; } $n; }