Created
November 19, 2021 02:21
-
-
Save jsta/986a71229fb1c2fd5d3c44e31bab4d90 to your computer and use it in GitHub Desktop.
Create a GTiff from an ascii grid with no raster metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a GTiff from an ascii grid with no raster metadata | |
# | |
# Examples | |
# # 4320: ncols | |
# # 2124: nrows | |
# # -180: xllcorner | |
# # -88.5: yllcorner | |
# # 0.0833333: cellsize | |
# touch test.txt | |
# txt2tif 4320 2124 -180 -88.5 0.0833333 test.txt test.tif | |
echo ncols $1 | cat - $6 > temp && mv temp $6 | |
echo nrows $2 | cat - $6 > temp && mv temp $6 | |
echo xllcorner $3 | cat - $6 > temp && mv temp $6 | |
echo yllcorner $4 | cat - $6 > temp && mv temp $6 | |
echo cellsize $5 | cat - $6 > temp && mv temp $6 | |
# cat $6 | |
gdal_translate -of GTiff $6 $7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.