Geoscience Reference
In-Depth Information
gdalinfo LC82070232013160LGN00.tif
...
Center
(
555600.000, 5883450.000) (
8d10'10.68"W, 53d
5'51.36"N)
...
This refers to the center of the center pixel. By shifting half a pixel size to the
upper left (subtracting 15 m from x and adding 15 m to y), we obtain the upper left
corner of this pixel
. The new upper left ( UL ) and lower right
( LR ) pixels of the subset image can then be calculated as:
(
555585
,
5883465
)
(
555585
100
30
,
5883465
+
100
30
) = (
552585
,
5886465
)
(UL)
(
555585
+
100
30
,
5883465
100
30
) = (
558585
,
5880465
)
(LR)
With this bounding box, the following command to subset the image should
produce the identical result as before. You can verify this with the utility gdalinfo .
gdal_translate -of GTiff -projwin 552585 5886465 558585 5880465
LC82070232013160LGN00.tif small_projwin.tif
5.5.3 Change Raster Attributes and Encoding
Geospatial raster data for which the georeference bounds or projection information
are not correctly assigned can be adjusted with gdal_translate . Suppose the
geographical information in our subset image from the previous example has been
broken. Given the georeference information is available, we can fix it with the com-
mand by explicitly assigning the correct spatial reference system and bounding box:
gdal_translate -of GTiff -a_srs EPSG:32629 -a_ullr 552585 5886465
558585 5880465 broken.tif fixed.tif
Other raster file attributes can be set in a similar way. The no-data value can be
assigned using the option -a_nodata . Textual data stored in raster data as metadata
tags can be inserted or changed using the -mo option. As an example, we add the
paths and filenames to TIFFTAG_DOCUMENTNAME for all GeoTIFF image files in
the current directory using the following script:
 
 
Search WWH ::




Custom Search