Portál AbcLinuxu, 30. dubna 2025 11:24
gdalwarp downloaded_file.tif map_name.tif
awk -f geotiff2gmi.awk map.tif >map_name.gmi
convert map_name.tif map_name.png
./TBCutter.pl -f map_name.png
mv map_name.gmi map_name/
map_name
to your TrekBuddy/maps directory
geotiff2gmi.awk:
BEGIN { if ( ARGC != 2 ) { print "Expecting exactly one parameter: tif file" exit } file=ARGV[1] cmd="test -f "file test=system(cmd) if ( test != 0 ){ print "File cannot be read. Exiting" exit } print "Map Calibration data file v3.0" print file cmd="gdalinfo "file "| sed -n \"/Size is/s/^[^0-9]*\([0-9]*\),.*/\\1/p\"" cmd | getline x cmd="gdalinfo "file "| sed -n \"/Size is/s/^[^0-9]*[0-9]*, \([0-9]*\)/\\1/p\"" cmd | getline y print x print y FS="[()]" cmd="gdalinfo "file while ( cmd | getline ) { gsub(" ","",$0) if ( $1 ~ /^UpperLeft/ ) {gsub(",",";",$2);print "0;0;"$2";"} if ( $1 ~ /^UpperRight/ ) {gsub(",",";",$2);print x";0;"$2";"} if ( $1 ~ /^LowerLeft/ ) {gsub(",",";",$2);print "0;"y";"$2";"} if ( $1 ~ /^LowerRight/ ) {gsub(",",";",$2);print x";"y";"$2";"} }
Tiskni
Sdílej:
system - potrebujem zistit exit code, vystup prikazu ma nezaujima. cmd | nieco - potrebujem spracovat vystup
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.