Changeset 712


Ignore:
Timestamp:
Feb 6, 2010, 7:00:12 PM (10 years ago)
Author:
Nick Burch
Message:

Per-decade support in tile scripts

Location:
trunk/npemap.org.uk/scripts/tile-processing
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/tile-processing/makeSmaller.pl

    r675 r712  
    2020# IN THE SOFTWARE.
    2121#
     22#
     23# This script reads in 1km grid square images from <map>-tiles-<year>
     24#  directories, and outputs (scaled) images as scaled#/<eee>/<nnn>.jpg
     25# By default it will go for the newest files it can, but if run from a
     26#  decade based directory, will be constrained to the newest tiles
     27#  of that decade.
     28#
    2229use List::Util qw[min max];
    2330use Image::Magick;
     
    4148}
    4249
    43 my @files = glob("*/tile-*.jpg");
     50# Are we running across all tiles in search of the most recent, or
     51#  are we constrained by a given decade?
     52my $dir_glob = "*";
     53
     54my $current_dir = `pwd`;
     55chomp $current_dir;
     56if($current_dir =~ /\/(19[0-6]0)s$/) {
     57    my $decade = $1;
     58    my $decade_match = substr($decade,0,3)."?";
     59    $dir_glob = "../*-$decade_match";
     60
     61    print "Restricting to just tiles from the decade '$decade'\n";
     62} else {
     63    print "Using the most recent tiles available\n";
     64}
     65print "\n";
     66sleep 2;
     67
     68# Find out files
     69my @files = glob("$dir_glob/tile-*.jpg");
    4470my %tiles ;
    4571
     
    124150            my $image = Image::Magick->new;
    125151            print $image->Read($input);
    126                         #print "  Including $input\n";
     152            if($scale == 1) {
     153                            print "\tIncluding $input\n";
     154            }
    127155
    128156                        if($rescale_by > 1) {
     
    147175            $out->Write("jpg:$filename");
    148176            undef $out;
    149             print "($x,$y)\n";
     177            print "\t($x,$y)\n";
    150178        }
    151179   }
  • trunk/npemap.org.uk/scripts/tile-processing/upload.pl

    r711 r712  
    6868    print "Detected OS Northern Ireland tiles, uploading to osie\n\n";
    6969    $remote_append = "osie/";
     70} else {
     71    $remote_append = "osgb/";
     72}
     73
     74# Are they uploading the latest tiles, or ones for just one
     75#  decade?
     76if($curdir =~ /\/(19[0-6]0s)\//) {
     77    my $decade = $1;
     78    print "Decade is set to the $decade\n";
     79    $remote_append .= $decade."/";
     80} else {
     81    print "No decade restriction, uploading latest tiles\n";
     82    $remote_append .= "latest/";
    7083}
    7184
    7285# Report what we're going to do
     86print "\n";
    7387print "About to upload ".join(" ",@args)." for scale $scale\n\n";
    7488
Note: See TracChangeset for help on using the changeset viewer.