/usr/share/xastir/scripts/toporama50k.pl is in xastir 2.0.6-4build2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | #!/usr/bin/perl -W
# $Id: toporama50k.pl,v 1.12 2012/11/01 18:57:19 we7u Exp $
# Copyright (C) 2004-2012 The Xastir Group.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# Look at the README for more information on the program.
# This will retrieve the 1:50k map images from the "Department of
# Natural Resources Geomatics Canada" site. These are topographic
# map files for the whole of Canada!
#
#
# - "cd /usr/local/share/xastir/maps"
#
# - Assure you have write privileges in the directory above either
# by becoming root using the "su" command, using "sudo", or
# temporarily changing ownership and/or privileges on the
# "maps" directory.
#
# - "/usr/local/lib/xastir/toporama50k.pl"
#
# - The script will create/populate this directory heirarchy:
# .../maps/toporama/images/
# .../maps/toporama/images/b50k/
#
# - Move/rename directories/contents as you see fit.
#
# - In Xastir: "Map->Configure->Index: Reindex ALL Maps!"
#
#
# Note that the same map files are also available from Steve Dimse's
# site: "http://mm.aprs.net/maps/geo/toporama"
#
#
# Code for this script contributed by Adi Linden, VA3ADI.
# Create the "toporama" directory
mkdir "toporama";
chdir "toporama";
# Retrieve the 1:50,000 map images. Skipping those that we've
# already downloaded.
`wget -nv -np -nH -N -r -m -l 0 -T 10 http://toporama.cits.rncan.gc.ca/images/b50k/`;
# Remove index.html files
`rm -rf \`find ./images -type f -name index.html\*\``;
# Remove *.asc files
`rm -rf \`find ./images -type f -name \*.asc\``;
# Define some stuff
$base_dir = "images/b50k";
# This defines the top left corner of the 0 grid.
$basex = '-56';
$basey = '44';
%offsetx = ( 'a' => 3,
'b' => 2,
'c' => 1,
'd' => 0,
'e' => 0,
'f' => 1,
'g' => 2,
'h' => 3,
'i' => 3,
'j' => 2,
'k' => 1,
'l' => 0,
'm' => 0,
'n' => 1,
'o' => 2,
'p' => 3,
'01' => 3,
'02' => 2,
'03' => 1,
'04' => 0,
'05' => 0,
'06' => 1,
'07' => 2,
'08' => 3,
'09' => 3,
'10' => 2,
'11' => 1,
'12' => 0,
'13' => 0,
'14' => 1,
'15' => 2,
'16' => 3 );
%offsety = ( 'a' => 3,
'b' => 3,
'c' => 3,
'd' => 3,
'e' => 2,
'f' => 2,
'g' => 2,
'h' => 2,
'i' => 1,
'j' => 1,
'k' => 1,
'l' => 1,
'm' => 0,
'n' => 0,
'o' => 0,
'p' => 0,
'01' => 3,
'02' => 3,
'03' => 3,
'04' => 3,
'05' => 2,
'06' => 2,
'07' => 2,
'08' => 2,
'09' => 1,
'10' => 1,
'11' => 1,
'12' => 1,
'13' => 0,
'14' => 0,
'15' => 0,
'16' => 0 );
use File::Find;
print "Writing .geo files\n";
find(\&process, $base_dir);
print "\nDone.\n";
# Run for each file found
sub process
{
# Only look for .gif files
if ( /.gif$/ ) {
# Get the map sheet designation from the file name
$file = "$_";
$grida = substr($file, 0, 3);
$gridb = substr($file, 3, 1);
$gridc = substr($file, 4, 2);
if ( $grida > 119 ) {
next;
}
# Calculate top left coordinates of the map sheet
use integer;
$topx = $basex - $grida / 10 * 8 + $offsetx{$gridb} * 2;
$topy = $basey + ($grida % 10) * 4 - $offsety{$gridb} * 1;
no integer;
$topx = $topx + $offsetx{$gridc} * 0.5;
$topy = $topy - $offsety{$gridc} * 0.25;
$botx = $topx + 0.5;
$boty = $topy - 0.25;
# Create the output file
$out = substr($file, 0, 6) . ".geo";
open (OUT, ">$out") or die "Can't open $OUT: $!\n";
print OUT "# Automatically created by toporama50k.pl\n";
print OUT "FILENAME\t$file\n";
print OUT "#\t\tx\ty\tlon\tlat\n";
print OUT "TIEPOINT\t0\t0\t$topx\t$topy\n";
print OUT "TIEPOINT\t3199\t1599\t$botx\t$boty\n";
print OUT "IMAGESIZE\t3200\t1600\n";
close OUT;
print ".";
}
}
|