Na dann. Ist nur für EPSG31469, da ich bisher nichts anderes gebraucht habe.
#! /usr/bin/perl
### This script reads the images from directory $imgDir, sorts them, and
### creates a new shape file in that directory.
use strict;
use warnings;
### The extracted images are expected in this directory.
my $imgDir = "epsg31469";
opendir(my $dh, $imgDir) or die "Can't opendir $imgDir: $!";
my %images;
while (my $file = readdir($dh)) {
if ($file =~ m/\.jgw$/) {
my $filePath = $imgDir."/".$file;
open(my $fd, $filePath) or die "Cannot read file $filePath: $!";
my $meterPerPixel = <$fd>;
$filePath =~ s/jgw$/jpg/;
$images{$filePath} = $meterPerPixel;
close($fd);
}
}
closedir $dh;
my $scriptName = "./run.sh";
open(my $fd, ">", $scriptName) or die "Cannot open run script: $!";
### Delete the old shape file and create a new one.
print $fd "#! /bin/sh\n\nrm $imgDir.sh* $imgDir.dbf\n\ngdaltindex $imgDir.shp \\\n";
foreach my $image (sort {$images{$b} <=> $images{$a}} keys(%images)) {
print $fd " $image \\\n";
}
print $fd " 2>&1 | grep -v \"is already in tileindex. Skipping it.\"\n";
close($fd);
chmod(0755, $scriptName);
### Run the script that we just created.
system($scriptName);
Edit: Ach so, funktioniert erstmal nur unter Unix/Linux wegen /bin/sh, rm und grep. Aber mal ehrlich, wer nimmt denn noch was anderes 