GDAL Commands
GDAL commands used for our public map archive
Lists information about a raster dataset
gdalinfo -stats input.tif
Prepare image fro new map coordinate system with GCPs
gdal_translate -of GTiff -a_srs EPSG:4326 -gcp x(longitude "pixel") y(latitude "line") easting(longitude degree decimal) northing(latitude degree decimal) input.tif output.tif
Warp an image into a new coordinate system
gdalwarp -of GTiff -t_srs EPSG:4326 input.tif output.tif
Publish image map for tiled viewer. generating TMS tiles, KMLs and web viewers
gdal2tiles.py --title="Map Title" --tile-format="jpeg" --zoom=12-23 --copyright=COPYRIGHT --googlekey=KEYCODE input.tif output_dir
generate MBTiles from GeoTiff
raster2mb input.tif output.mbtiles
generate JPG from GeoTiff
gdal_translate -of JPEG -b 1 -b 2 -b 3 input.tif output.jpg
convert raster data between different formats - With a_ullr
gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr ulx uly lrx lry input.tif output.tif
convert geotiff to spherical mercator JPG
gdalwarp -of GTiff -t_srs EPSG:900913 input.tif output.jpg
All gdal utility programs http://gdal.org/gdal_utilities.html
Customizations
MrSID converting to GeoTIFF
Following advice listed on http://gdal.org/frmt_mrsid.html and http://casoilresource.lawr.ucdavis.edu/drupal/node/98, we're putting installing a modified GDAL to be able to convert USDA MrSID files into geotiff:
Add the DSDK path to configure: --with-mrsid=/Geo_DSDK-6.0.7.1407/ There is a bug in Geo_DSDK-6.0.7.1407//include/base/lti_sceneBuffer.h line 356:
bool LTISceneBuffer::inWindow(lt_uint32 x, lt_uint32 y) const; // <--- line 356
Comment out this line, and re-compile. Thanks to Mateusz Loskot on the GDAL IRC channel for pointing this out.
gdal_translate file.sid file.tif