[Gdal-dev] Different UTM Zones...
Tyler Mitchell
tylermitchell at shaw.ca
Sat Aug 7 23:35:51 EDT 2004
On August 7, 2004 06:48 pm, StefanReisser at t-online.de wrote:
> Hi!
Hi Stefan - lots of questions! That's good :)
> I have a huge GeoTiff image and I want to extract that part, that
> perfectly matches a specific DEM file.
> It's easy, as long as both the image and the DEM use the same projection
> and geographic coordinate system.
>
> However, if the UTM zones are different, or the geographic coordinate
> system is different, how can I compute the raster coordinates
> of the DEM inside the GeoTiff image?
>
> How can I convert coordinates between different UTM zones and
> furthermore, how can I convert between Lat/Long and UTM coordinates?
A Proj4 utility called cs2cs (coordinate system 2 coordinate system) will
probably do the trick for you, unless you want to actually reproject your
datasets.
Get the extent of the DEM and put the pair of coordinates (one x y pair per
line) into a text file. Then run cs2cs with a few options to have those
coordinates reprojected and printed to your screen.
For example:
Contents of utm.txt (easting, northing)
--------------
5500000 450000
--------------
Project from one UTM zone to another:
> cs2cs +proj=utm +zone=10 +to +proj=utm +zone=11 utm.txt
Outputs:
4649861.81 414740.36 0.00 (0.00 is elevation which I left blank)
To project from UTM to lat/long:
> cs2cs +proj=utm +zone=10 +ellps=GRS80 +to +proj=latlong utm.txt
123d41'33.592"W 49d39'1.696"N 0.000
If your file has y then x (as opposed to x then y which is default) add the
option "-r" to the command.
So using cs2cs you should be able to get the projwin coordinates you need to
use gdal_translate to cut out a piece of an image you are interested in.
> gdal_translate -projwin <upper left x> <upper left y> <lower right x>< lower
right y> image1.tif clipped.tif
Will clip the area you want.
You could then, optionally reproject from one coordinate system to another
using gdalwarp.
Let us know if you need more help using these utilities.
Enjoy.
Tyler
More information about the Gdal-dev
mailing list