Hi,

I just want to inform all who was following this thread that I succeeded to make contour from Aster v2 and Cgiar too.
Cgiar is the far best source of elevation data at the moment ( fixed all anomalies ).

I want to publish here perl script I did for data conversion, maybe they can be useful for someboby, maybe somebody can improve them.


Perl script for converting Aster dem.tif to hgt:

#!/usr/bin/perl -w

while (< *.tif>) {

$tile = $_;
$tile =~ s/dem.tif//;
$tile =~ s/ASTGTM2
//;
$tile =~ m/([SN])(\d+)([EW])(\d+)/;

`gdalwarp -of GTiff -srcnodata 32767  -rcs -order 3 -ts 1201 1201 -multi ASTGTM2_${tile}_dem.tif ${tile}.tif` ;

`gdal_translate -of SRTMHGT ${tile}.tif ${tile}.hgt` ;

`rm ${tile}.tif ${tile}.hgt.aux.xml` ;

}


Perl script for converting cgiar 1 degree tiles to hgt:

#!/usr/bin/perl -w

while (< *.zip>) {
$file_asc = $_;
$file_asc=~ s/.zip//;

unless (-e “${file_asc}.asc”) {unzip $_};
open(READ, “${file_asc}.asc” ) or die $! ;
@lines = ;
close (READ);

  $x = $lines[2];
  $y = $lines[3];

  $x =~ s/xllcorner     //;
  $y =~ s/yllcorner     //;

if ($x > 0 ) {
$lat = “N”;
} else {
$lat = “S”;
}

if ($y > 0 ) {
$lon = “E”;
} else {
$lon = “W”;
}

$rx = sprintf(“%.0f”, $x);
$ry = sprintf(“%.0f”, $y);

$arx = abs $rx ;
$ary = abs $ry ;

$tile = “$lat” . “$ary” . “$lon” . “0” . “$arx” ;

`gdalwarp -of GTiff -rcs -order 3 -ts 1201 1201 -multi ${file_asc}.asc ${tile}.tif` ;

`gdal_translate -of SRTMHGT ${tile}.tif ${tile}.hgt` ;

rm ${file_asc}.asc ;

`rm ${tile}.tif ` ;
`rm ${tile}.hgt.aux.xml ` ;

}