- Reprojection
- Downscaling
- Clipping
- Merging
- Hillshading
- Creating an RGBA multiband from a single band
- Tiling
- Shape extraction from shape
- Tips
GeoTiff
gdalwarp -overwrite -wm 1500 -t_srs EPSG:4326 -of GTiff /path/to/input.tif /path/to/output.tif
ENVI .hdr labeled
gdalwarp -overwrite -wm 1500 -t_srs EPSG:4326 -of ENVI /path/to/input.tif /path/to/output.tif
Where the input is an existing raster file /path/to/input.tif
and the output is a new raster file /path/to/output.tif
gdalwarp -t_srs EPSG:4326 -r cubic -tr 0.000185185 0.000185185 input-90m.tif output-20m.tif
# Mapping under 20 degrees latitude
# 0.000046296 is 5 meters
# 0.000092593 is 10 meters
# 0.000185185 is 20 meters
# 0.000277778 is 30 meters
# 0.000833333 is 90 meters
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |
gdalwarp -wm 1500 -cutline /path/to/mold.shp -crop_to_cutline -tr 20.0 20.0 -of GTiff /path/to/input.tif /path/to/output.tif
Where the inputs are an existing raster file /path/to/input.tif
and an existing shape file /path/to/mold.shp
the output is a new raster file /path/to/output.tif
# Step 1
# Create a VRT from a bunch of tiles
gdalbuildvrt /path/to/mosaic.vrt /path/to/tiles/*.tif
# Step 2
# Create a GeoTIFF from the VRT
gdal_translate /path/to/mosaic.vrt /path/to/mosaic.tif
gdaldem hillshade input.tif output.tif -of GTiff -b 1 -z 0.00000956 -s 1.0 -az 315.0 -alt 56.25
# Sun setting
# -alt 45.00 is too dark
# -alt 56.25 is just about right
# -alt 67.50 is too shinny
See the gdaldem reference manual for more details
-z 2e-05
refers to the Z-factor based from an article on setting the correct Z-factor
gdaldem color-relief input.mosaic.vrt input.color.txt output.mosaic.vrt -alpha -of VRT -nearest_color_entry
See the syntax for input.color.txt
.
gdal_rasterize -l RiceAtlas -a PLANT_PK1 -tr 0.01 0.01 -a_nodata 0.0 -ot Int16 -of GTiff "/path/to/input.shp" "/path/to/output.tif"
Where:
-a PLANT_PK1
refers to thePLANT_PK1
attribute of the shapefile
gdal2tiles.py --processes=2 --zoom=2-16 /path/to/input.vrt /path/to/output
North: 21.288
South: 4.143
West: 109.974
East: 134.221
North: 19.654
South: 4.583
West: 116.925
East: 126.980
ogr2ogr -where "attribute_name = 'desired_value'" output_shapefile.shp input_shapefile.shp