@@ -15,6 +15,7 @@ use strict;
1515use warnings;
1616use FindBin;
1717
18+ use Getopt::Long;
1819use LWP::UserAgent;
1920use JSON::PP;
2021use lib " $FindBin::RealBin /.." ;
@@ -49,6 +50,21 @@ my $max_lon = 13.764158;
4950my $min_lat = 52.337621;
5051my $max_lat = 52.689878;
5152
53+ my $mvt_impl = ' pl' ;
54+
55+ GetOptions(
56+ " cache!" => \$do_cache ,
57+ " bbox=s" => \my $bbox ,
58+ " mvt-impl=s" => \$mvt_impl ,
59+ )
60+ or die " usage: $0 [--[no]cache]] [--mvt-impl pl|py] [--bbox minlon,minlat,maxlon,maxlat] YYYYMMDD-[YYYYMMDD]\n " ;
61+
62+ if ($bbox ) {
63+ my @fields = split /,/, $bbox ;
64+ die " --bbox must have four fields\n " if @fields != 4;
65+ ($min_lon ,$min_lat ,$max_lon ,$max_lat ) = @fields ;
66+ }
67+
5268my $date_range = shift ;
5369my $date_from = " " ;
5470my $date_to = " " ;
@@ -151,9 +167,13 @@ for my $tile (@tiles) {
151167 }
152168 }
153169
154- # Call Python script
155- # my $json = `python3 $FindBin::RealBin/parse_mvt_sequences.py $file "$date_from" "$date_to"`;
156- my $json = ` $^X $FindBin::RealBin /parse_mvt_sequences.pl $file "$date_from " "$date_to "` ;
170+ # Call Python or Perl script for mvt/protobuf decoding
171+ my $json ;
172+ if ($mvt_impl eq ' py' ) {
173+ $json = ` python3 $FindBin::RealBin /parse_mvt_sequences.py $file "$date_from " "$date_to "` ;
174+ } else {
175+ $json = ` $^X $FindBin::RealBin /parse_mvt_sequences.pl $file "$date_from " "$date_to "` ;
176+ }
157177 my $results = eval { decode_json($json ) };
158178 if ($results && ref $results eq ' ARRAY' ) {
159179 for my $seq (@$results ) {
0 commit comments