Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ META.yml
MYMETA.yml
nytprof.out
pm_to_blib
/local
/tilers_tools
/mbutil
/parallelGdal2tiles
DDTPP*.zip

16 changes: 14 additions & 2 deletions georeference_airport_diagrams_via_db.pl
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@

use vars qw/ %opt /;

# Define the valid command line options
my $opt_string = 'nspva:c:i:';

#Define the valid command line options
my $opt_string = 'cspva:c:i:d:';

my $arg_num = scalar @ARGV;

# We need at least one argument (the name of the PDF to process)
Expand Down Expand Up @@ -148,8 +150,17 @@
our $dbh;
my $sth;

my $dbhPath = "../processFaaData/nasr.sqlite";
if ( $opt{d} ) {
#If something provided on the command line use it instead
$dbhPath = $opt{d};
say "Supplied airport lat/long db: $dbhPath";
}

# The nasr database created by processFaaData
$dbh =
DBI->connect( "dbi:SQLite:dbname=nasr.sqlite", "", "", { RaiseError => 1 } )

or croak $DBI::errstr;

our (
Expand Down Expand Up @@ -2530,6 +2541,7 @@ sub touchFile {
sub usage {
say "Usage: $0 <options> <directory_with_PDFs>";
say "-v debug";
say "-d<path of airport db> The path of the nasr db generated by processFaaData.";
say "-a<FAA airport ID> To specify an airport ID";
say "-i<2 Letter state ID> To specify a specific state";
say "-p Output a marked up version of PDF";
Expand Down
50 changes: 37 additions & 13 deletions load_dtpp_metadata.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
my $arg_num = scalar @ARGV;

#Define the valid command line options
my $opt_string = 'dr';
my $opt_string = 'dra:';

#This will fail if we receive an invalid option
unless ( getopts( "$opt_string", \%opt ) ) {
Expand All @@ -67,6 +67,17 @@
exit(1);
}

#Default to all airports for the SQL query
our $airportId = "";
if ( $opt{a} ) {
#If something provided on the command line use it instead
$airportId = $opt{a};
say "Supplied airport ID: Only $airportId will be processed!";
}

our $downloadAll = $opt{d};


my $BASE_DIR = shift @ARGV;
my $cycle = shift @ARGV;

Expand All @@ -87,30 +98,29 @@
# die "$dtppDownloadDir doesn't exist" if ( !-e $dtppDownloadDir );

#URL of the DTPP catalog


# my $dtpp_url =
# "http://aeronav.faa.gov/d-tpp/$cycle/xml_data/d-TPP_Metafile.xml";
# my $dtpp_url = "https://nfdc.faa.gov/webContent/dtpp/current.xml";

my ( $count, $downloadedCount, $deletedCount, $changedCount, $addedCount );
my ( $count, $downloadedCount, $deletedCount, $changedCount, $addedCount ) = (0) x 5;

my %countHash;

if ( -e $TPP_METADATA_FILE ) {
say "Using existing local metafile: $TPP_METADATA_FILE";
}
else {
die
"Unable to load dTPP metadata catalog: $TPP_METADATA_FILE does not exist locally";
print "Downloading the d-TPP metafile: " . $dtpp_url . "...";

# my $ret = 200;
my $ret = getstore( $dtpp_url, $TPP_METADATA_FILE );

# print "Downloading the d-TPP metafile: " . $dtpp_url . "...";
#
# # my $ret = 200;
# my $ret = getstore( $dtpp_url, $TPP_METADATA_FILE );
#
# if ( $ret != 200 ) {
# die "Unable to download d-TPP metadata.";
# }
# print "done\n";
if ( $ret != 200 ) {
die "Unable to download d-TPP metadata.";
}
print "done\n";

}

Expand Down Expand Up @@ -339,6 +349,11 @@ sub record {

++$count;

if ( !( $airportId eq "" ) && $airportId ne $faa_code) {
#say "Skipping airport $faa_code";
return;
}

say "\rLoading # $count : $pdf_name: $chart_name";

#TPP_VOLUME
Expand Down Expand Up @@ -393,19 +408,27 @@ sub record {
#deleteStaleFiles($pdf_name);
++$deletedCount;
}

my $doDownload = 0;
if ( $user_action =~ /A/i ) {
say "Added " . "$dtppDownloadDir" . "$pdf_name";

#downloadPlate($pdf_name);

++$addedCount;
$doDownload = 1

}
if ( $user_action =~ /C/i ) {

#downloadPlate($pdf_name);
++$changedCount;
$doDownload = 1;
}

if ($doDownload || $downloadAll) {
downloadPlate($pdf_name);
}
#If the pdf doesn't exist locally fetch it
#but don't bother trying to download DELETED charts
if ( !( $pdf_name =~ /DELETED/i )
Expand Down Expand Up @@ -596,5 +619,6 @@ sub usage {
say "eg: $0 . 1502";
say "-d Download ALL plates (default is only added/new)";
say "-r Rasterize ALL plates (default is only added/new)";
say "-a<FAA airport ID> To specify an airport ID";

}