Jesus Loves GRASS

Technical blog about GRASS/GIS,open source geoinformatics and MAPSERVER.

Monday, December 11, 2006

Problems with UALG's proxy (of the SRTM script)

In BGU the proxy accepts FTP connections and everything runs ok (as long the Iptables is off and the enviromment has the proxy's url). The problem is that the proxy from UALG only accepts HTTP, I have tried to upgrade the FTP connection of the script to deal with it, but it was a nightmare.

The simplest solution was to use the wget command instead of an FTP connection

The the case of running from BGU or UALG the enviromments need to have the proxy:
BGU: http://wwwbgu.ac.il:8080
UALG: http://proxy1.si.ualg.pt:8080

#!/usr/bin/perl

use strict;
use warnings;
use Net::FTP;
#variable declaration
#specific varibles, change here according to needs
my $ftp_url="ftplmu.jrc.it";
my $ftp_pwd="/pub/SRTM_v3/SRTM_Data_GeoTiff";
my $ftp_file;
my $cmd;
my $ftp;
#input variables
my $max_x;
my $min_x;
my $max_y;
my $min_y;
#other variables
my $temp_min_y;
my $formated_number_y;
my $formated_number_x;
my $file_url;
#user input
print "Enter tile number of maximum long. (x): ";
$max_x=<STDIN>;
chomp($max_x);
print "Enter tile number of minimum long. (x): ";
$min_x=
<STDIN>;
chomp($min_x);
print "Enter tile number of maximum lat. (y): ";
$max_y=
<STDIN>;
chomp($max_y);
print "Enter tile number of minimum lat. (y): ";
$min_y=
<STDIN>;
chomp($min_y);
#for loop to generate the url and open the FTP connection
$temp_min_y=$min_y;
for ( ;$min_x<=$max_x; $min_x++) { #some nice C/C++ sytanx $formated_number_x=sprintf("%02d",$min_x); $min_y=$temp_min_y; for( ;$min_y<=$max_y; $min_y++) { $formated_number_y=sprintf("%02d",$min_y); $ftp_file="srtm_".$formated_number_x."_".$formated_number_y.".zip"; #using wget to get the file, wget will use the system's variable of proxy $cmd="wget ftp://".$ftp_url.$ftp_pwd."/".$ftp_file; system($cmd); } }

0 Comments:

Post a Comment

<< Home