Geoscience Reference
In-Depth Information
This is useful when overlaying different raster images in an image viewer. In the fol-
lowing example, the GeoTIFF image, which is in a local Belgian coordinate system
(Belgian Lambert 72), is warped to the European projection (ETRS89/LAEA). Val-
ues outside the original bounding box get a no-data value of 255. The output image
gets an alpha band to identify the no-data pixels.
gdalwarp -s_srs EPSG:31370 -t_srs EPSG:3035 -dstnodata 255
-dstalpha belgium.tif belgium_eu.tif
If not specified with -tr or -ts , gdalwarp automatically computes the output
spatial resolution. It tries to preserve the number of pixels from the upper left to
the lower right corner from the input to the output image. The output pixel size is
hereby forced to be square. To avoid arbitrary output resolutions (e.g., 24
.
9959 m),
it is better to explicitly set the target resolution (e.g., 25 m).
8.3.2 Warp Images
If you have a raw image that needs to be registered to a spatial reference system,
you must define ground control points (GCP). Such points link image coordinates
(column, row) to target georeferenced coordinates (X, Y). The number of points
defines the transformation that can be applied. For optimal performance, the GCP
should be evenly distributed across the image. The format to list a GCP on the com-
mand line is: column line X Y, with X and Y the coordinates in the target coordinate
system. In case of a geographical coordinate system WGS84 (EPSG:4326), X and
Y represent longitude and latitude respectively (mind the order: first Lon, then Lat).
A simple example is to warp the global NASA blue marble image (Stöckli et al.
2005) available from NASA's website. 1 It is a JPG image that covers the full globe
from
90 (lower right corner) in 21600 columns
and 10800 lines (check with gdalinfo ). We select a geographical coordinate
systemWGS84 (EPSG:4326) as the target coordinate system, using only three GCP
for the transformation.
In the first command, gdal_translate adds three GCP's to the image: the
upper left, upper right and lower right corner of the image. The second command
performs thewarping, based on theseGCP's using the gdalwarp utility. Thewarped
image with annotated geographic coordinates is shown in Fig. 8.5 .
180 90 (upper left corner) to 180
gdal_translate -a_srs EPSG:4326 -gcp 0 0 -180 90 -gcp 21600 0
180 90 -gcp 21600 10800 180 -90
world.topo.200408.3x21600x10800.jpg world_gcp.tif
gdalwarp -t_srs EPSG:4326 world_gcp.tif world_warped.tif
1 http://visibleearth.nasa.gov/view.php?id=74418
 
 
Search WWH ::




Custom Search