logo separator

[mkgmap-dev] DEM-file generation from geo-tiff sources ?

From Felix Hartmann extremecarver at gmail.com on Sat May 5 17:15:03 BST 2018

Sorry for bringing this back up - I'm having problems converting tiff to
.hgt. - how can I run a script that converts all geotiff (not 25m
resolution but 30m) in folder /home/example/ to .hgt?
Basically I want to fill the voids in SRTM1v30 and need to convert .hgt to
tiff as gdal and then get them back to hgt.

so first I simply run:


for hgtfile in *.hgt;do gdal_fillnodata.py -md 500 $hgtfile $hgtfile.tif;
done

which will voildfill all .hgt files but gdal created rubbish (at least if I
feed it to phyghtmap) if I try to simply voildfill hgt and have output also
as hgt. So I need to convert them back to hgt before I can hand them over
to pyhghtmap.
It should work vs a folder of the whole world 60N/60S.


Best in bash if possible, but perl is also fine if I understand the steps
(I downloaded the SRTM1 from earthexplorer as .hgt - or better I will have
them in a couple of days, download is pretty slow even though it is only
85GB zipped...)

On 7 January 2018 at 13:25, franco_bez <franco.bez at web.de> wrote:

> Frank Stinner-2 wrote
> > Hi Franco,
> >
> > i have seen an silly error in my area. Europa is a little bit greater ;)
> > Just i have "$lattop = 70". The split create 3608 tif's with 4,5 GB in 85
> > min. gdal4hgt create 1171 zipped hgt's with 5,8 GB in 3 h :((
> > And then i rebuild the tif's from the hgt's in 20 min. That are 4 GB.
>
> OK
>
> > Perhaps you have an to old gdal-version without lzw-compression? Or
> > perhaps
>
> It's the current version of gdal
>
> > -co \"COMPRESS=LZW\" -co \"TILED=YES\" -co \"PREDICTOR=2\"
> >
> > should be better
> >
> > -co COMPRESS=LZW -co TILED=YES -co PREDICTOR=2
>
> That did the trick :-)
>
> Thanks a lot.
>
> now this is the new perl script for Ubuntu
> ---
>
> use strict;
>
> my $lonleft = -24;
> my $lonright = 50;
> my $latbottom = 27;
> my $lattop = 70;
>
> my $srcdir = "..";
>
> my $delta = 1 / 3600 / 2;     # half pixel
>
> print "#!/bin/sh\n";
> print "GDAL_TRANSLATE_OPT='-multi -wo NUM_THREADS=ALL_CPUS -t_srs EPSG:4326
> -r near -ot Int16 -dstnodata -32768 -of GTiff -co COMPRESS=LZW -co
> TILED=YES
> -co PREDICTOR=2 -ts 3601 3601'\n";
> for (my $lat = $latbottom; $lat != $lattop; $lat++) {
>     for (my $lon = $lonleft; $lon != $lonright; $lon++) {
>        printf "gdalwarp \$GDAL_TRANSLATE_OPT -te %.7f %.7f %.7f %.7f
> $srcdir/all.vrt %s%02d%s%03d.tif\n",
>               $lon - $delta,
>               $lat - $delta,
>               $lon + 1 + $delta,
>               $lat + 1 + $delta,
>               'N',
>               $lat >= 0 ? $lat : -$lat,
>               $lon >= 0 ? 'E' : 'W',
>               $lon >= 0 ? $lon : -$lon;
>     }
> }
>
> ---
>
> Ciao,
>   Franco
>
>
>
> --
> Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>



-- 
Felix Hartman - Openmtbmap.org & VeloMap.org
Schusterbergweg 32/8
6020 Innsbruck
Austria - Österreich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20180505/efd6b71f/attachment.html>


More information about the mkgmap-dev mailing list