#!/usr/bin/perl # grat --- set up graticule lines # Author: Dan Jacobson https://www.jidanni.org/ # Copyright: https://www.gnu.org/licenses/gpl.html # Created: 2023-09-03T11:01:01+0000 # Last-Updated: 2023-09-27T19:58:32+0000 # Update #: 7 # #set up graticule lines use warnings q(all); use strict; #do only one dimension (only N/S, only E/W), #because the axes might not be perpendicular anyway, #e.g., Highland Park, IL. die "ARGS: Xmin Xmax Ymin Ymax Increment AXIS(0/1)" unless @ARGV==6; my ($increment, $axis)=@ARGV[4..5]; die "0 will cause loop, dude" unless $increment; my @range; for (0,1){ $range[$_]=[shift, shift]; my $v=$range[$_][0]; warn "Are you sure you want $v min, that are not a clean \$increment?" if $v % $increment; } my @letter=([qw/W E/],[qw/S N/]); for(my $i=$range[$axis][0]; $i<=$range[$axis][1]; $i+=$increment){ printf ">-L%d%s\n", abs $i, $i?$letter[$axis][$i>=0]:join "", reverse @{$letter[$axis]}; #reverse, so sounds more English for my $m(0,1){ my @t=($i,$range[!$axis][$m]); printf "%d %d\n", $axis?reverse @t:@t;}}