diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/canonicalise-csv | 3 | ||||
-rwxr-xr-x | bin/convert.pl | 49 | ||||
-rwxr-xr-x | bin/convertL.pl | 62 | ||||
-rwxr-xr-x | bin/convertLB.pl | 51 |
4 files changed, 2 insertions, 163 deletions
diff --git a/bin/canonicalise-csv b/bin/canonicalise-csv index 6163b3741..17b952769 100755 --- a/bin/canonicalise-csv +++ b/bin/canonicalise-csv @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: canonicalise-csv,v 1.2 2007-01-26 22:48:30 matthew Exp $ +# $Id: canonicalise-csv,v 1.3 2007-02-02 12:23:06 matthew Exp $ use strict; require 5.8.0; @@ -31,6 +31,7 @@ while (<FP>) { s/\r?\n//g; my ($name, $email) = split /,/; $email ||= ''; + $email =~ s/\xa0//g; # Canonicalise next if $name eq 'Londonderry'; # Dupe of Derry diff --git a/bin/convert.pl b/bin/convert.pl deleted file mode 100755 index a5e3d7a6b..000000000 --- a/bin/convert.pl +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/perl -w - -# convert.pl: -# Out of date tile conversion -# -# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: convert.pl,v 1.1 2006-09-19 15:08:36 matthew Exp $ - -use strict; - -my @squares = ( - '', '', '', '', 'HP', '', '', - '', '', '', 'HT', 'HU', '', '', - '', 'HW', 'HX', 'HY', 'HZ', '', '', - 'NA', 'NB', 'NC', 'ND', '', '', '', - 'NF', 'NG', 'NH', 'NJ', 'NK', '', '', - 'NL', 'NM', 'NN', 'NO', '', '', '', - '', 'NR', 'NS', 'NT', 'NU', '', '', - '', 'NW', 'NX', 'NY', 'NZ', 'OV', '', - '', '', 'SC', 'SD', 'SE', 'TA', '', - '', '', 'SH', 'SJ', 'SK', 'TF', 'TG', - '', 'SM', 'SN', 'SO', 'SP', 'TL', 'TM', - '', 'SR', 'SS', 'ST', 'SU', 'TQ', 'TR', - 'SV', 'SW', 'SX', 'SY', 'SZ', 'TV', ''); - -my %squares; -my $i = 0; -foreach my $square (@squares) { - $squares{$square} = $i if $square; - $i++; -} - -for (<*.png>) { - /^(..)-(\d+)\.png$/ or die $!; - my $square = $1; - $square = $squares{$square}; - my $square_row = int($square/7); - my $square_col = $square%7; - my $part = $2; - my $part_row = int($part/16); - my $part_col = $part%16; - - my $out_col = $square_col*16+$part_col; - my $out_row = $square_row*16+$part_row; - print "$_ $square_row $square_col $part_row $part_col : $out_col x $out_row\n"; - system("cp $_ $out_col.$out_row.png"); -} diff --git a/bin/convertL.pl b/bin/convertL.pl deleted file mode 100755 index 429dc26d9..000000000 --- a/bin/convertL.pl +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/perl -w - -# convertL.pl: -# Out of date tile conversion -# -# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ - -use strict; - -my @squares = ( - '', '', '', '', 'HP', '', '', - '', '', '', 'HT', 'HU', '', '', - '', 'HW', 'HX', 'HY', 'HZ', '', '', - 'NA', 'NB', 'NC', 'ND', '', '', '', - 'NF', 'NG', 'NH', 'NJ', 'NK', '', '', - 'NL', 'NM', 'NN', 'NO', '', '', '', - '', 'NR', 'NS', 'NT', 'NU', '', '', - '', 'NW', 'NX', 'NY', 'NZ', 'OV', '', - '', '', 'SC', 'SD', 'SE', 'TA', '', - '', '', 'SH', 'SJ', 'SK', 'TF', 'TG', - '', 'SM', 'SN', 'SO', 'SP', 'TL', 'TM', - '', 'SR', 'SS', 'ST', 'SU', 'TQ', 'TR', - 'SV', 'SW', 'SX', 'SY', 'SZ', 'TV', ''); - -my %squares; -my $i = 0; -foreach my $square (@squares) { - $squares{$square} = $i if $square; - $i++; -} - -print "Converting TIF to PNGs...\n"; -for (</home/tom/25k/BaseMap/*.TIF>) { - /(S[Q-Z]\d+).TIF$/ or next; - my $name = $1; - unless (-e "$name-0.png") { - print " $_\n"; - `convert $_ -crop 250x250 tl/$name.png`; - } -} -print "Renaming PNGs...\n"; -for (<tl/*.png>) { - /^tl\/(..)(\d+)-(\d+)\.png$/ or next; - print " $_\n"; - my $square = $1; - $square = $squares{$square}; - my $square_row = int($square/7); - my $square_col = $square%7; - my $parta = $2; - my $parta_col = int($parta/10); - my $parta_row = 9 - $parta%10; - my $partb = $3; - my $partb_row = int($partb/16); - my $partb_col = $partb%16; - - my $out_col = ($square_col*10+$parta_col)*16+$partb_col; - my $out_row = ($square_row*10+$parta_row)*16+$partb_row; -# print "$_ $out_col x $out_row\n"; - system("mv $_ tl/$out_col.$out_row.png"); -} -print "Done.\n"; diff --git a/bin/convertLB.pl b/bin/convertLB.pl deleted file mode 100755 index 42a2401db..000000000 --- a/bin/convertLB.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl -w - -# convertLB.pl: -# Out of date tile conversion -# -# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: convertLB.pl,v 1.1 2006-09-19 15:08:36 matthew Exp $ - -use strict; - -my @squares = ( - '', '', '', '', 'HP', '', '', - '', '', '', 'HT', 'HU', '', '', - '', 'HW', 'HX', 'HY', 'HZ', '', '', - 'NA', 'NB', 'NC', 'ND', '', '', '', - 'NF', 'NG', 'NH', 'NJ', 'NK', '', '', - 'NL', 'NM', 'NN', 'NO', '', '', '', - '', 'NR', 'NS', 'NT', 'NU', '', '', - '', 'NW', 'NX', 'NY', 'NZ', 'OV', '', - '', '', 'SC', 'SD', 'SE', 'TA', '', - '', '', 'SH', 'SJ', 'SK', 'TF', 'TG', - '', 'SM', 'SN', 'SO', 'SP', 'TL', 'TM', - '', 'SR', 'SS', 'ST', 'SU', 'TQ', 'TR', - 'SV', 'SW', 'SX', 'SY', 'SZ', 'TV', ''); - -my %squares; -my $i = 0; -foreach my $square (@squares) { - $squares{$square} = $i if $square; - $i++; -} - -for (<tl/*.png>) { - /^tl\/(\d+)\.(\d+)\.png$/ or die; - my $x = $1; - my $y = $2; - my $partb_col = $x%16; - my $partb_row = $y%16; - my $parta_col = int($x/16)%10; - my $parta_row = 9 - int($y/16)%10; - my $square_col = int(int($x/16)/10); - my $square_row = int(int($y/16)/10); - - my $square = $squares[$square_row*7+$square_col]; - my $parta = 10*$parta_col+$parta_row; - my $partb = $partb_col+$partb_row*16; -# print "$_ : $square$parta-$partb.png\n"; - system("mv $_ tl/$square$parta-$partb.png"); -} |