[Gdal-dev] UTM to Lat/Lon

Andrey Kiselev dron at ak4719.spb.edu
Thu Sep 4 03:22:59 EDT 2003


On Wed, Sep 03, 2003 at 02:22:51PM -0500, Matthew Harmon wrote:
> I need to create a tool to convert GeoTIFF in UTM to image tiles in
> geographic (lat/lon) projection.  It looks like the Warp API will do
> the trick for me, but I have a few questions.
> 
> -          How do I set up the output coordinate system correctly?  It
> appears I need to supply a WKT for the destination coordinate system,
> but I don?t know how to set this up for geographic.

You can use PROJ.4 style for specifying projections and coordinate systems with -t_srs option. For you it should looks like

 -t_srs "+proj=latlong +datum=WGS84"

> -          I?m looking at the ?GDAL Warp API Tutorial? as well as the
> source to gdalwarp and gdalwarp test.  Is this the place to be
> looking?

Yes, with except that gdalwarp utilizes old warping API. New API with
more flexible design and tuned for speed implementation used in
gdalwarptest, use this utility for your tasks.

> - The relationship between source GeoTIFF and destination imagery
> tiles may be one-to-many or many-to-one.  In other words, one big 500
> Meg GeoTIFF may encompass many destination tiles, or one tile may
> require many GeoTIFF images as input.  Is there an alpha channel or
> ?null? color that can be used for combining images?

Yes, with -srcnodata option you can set one or several (comma separated)
NODATA values. Pixels marked in such way will not be used when warping
into existing image.

-te option (Target Extent) helps you to specify size of target image. It
should be in degrees for LAT/LONG projection.

There is my live session shows how to combine two ASTER DEM images (UTM
projection) into single LAT/LONG one:

$ gdalinfo ASTER_DEM20030819114347.tif
Driver: GTiff/GeoTIFF
Size is 2725, 2649
Coordinate System is:
PROJCS["WGS 84 / UTM zone 36N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",33],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32636"]]
Origin = (324834.000000,6723220.000000)
Pixel Size = (30.000000,-30.000000)
Corner Coordinates:
Upper Left  (  324834.000, 6723220.000) ( 29d47'59.90"E, 60d36'23.32"N)
Lower Left  (  324834.000, 6643750.000) ( 29d52'7.69"E, 59d53'38.45"N)
Upper Right (  406584.000, 6723220.000) ( 31d17'32.31"E, 60d38'1.91"N)
Lower Right (  406584.000, 6643750.000) ( 31d19'44.73"E, 59d55'14.24"N)
Center      (  365709.000, 6683485.000) ( 30d34'21.08"E, 60d15'56.91"N)
Band 1 Block=2725x3 Type=Float32, ColorInterp=Gray

$ gdalinfo ASTER_DEM20030819131301.tif
Driver: GTiff/GeoTIFF
Size is 2726, 2649
Coordinate System is:
PROJCS["WGS 84 / UTM zone 36N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",33],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32636"]]
Origin = (302971.000000,6667033.000000)
Pixel Size = (30.000000,-30.000000)
Corner Coordinates:
Upper Left  (  302971.000, 6667033.000) ( 29d27'23.53"E, 60d 5'34.18"N)
Lower Left  (  302971.000, 6587563.000) ( 29d31'52.33"E, 59d22'49.99"N)
Upper Right (  384751.000, 6667033.000) ( 30d55'32.82"E, 60d 7'26.49"N)
Lower Right (  384751.000, 6587563.000) ( 30d58'10.42"E, 59d24'39.16"N)
Center      (  343861.000, 6627298.000) ( 30d13'14.70"E, 59d45'14.74"N)
Band 1 Block=2726x3 Type=Float32, ColorInterp=Gray

$ ./gdalwarptest -t_srs "+proj=latlong +datum=WGS84" -te 29.4 59.3 31.3 60.7 ASTER_DEM20030819114347.tif out.tif
Creating output file is that 4309P x 3175L.
Upper Left 29.400000, 60.700000
Pixel size: 0.000441, -0.000441
:0...10...20...30...40...50...60...70...80...90...100 - done.

$ ./gdalwarptest -t_srs "+proj=latlong +datum=WGS84" -srcnodata -150 ASTER_DEM20030819131301.tif out.tif
:0...10...20...30...40...50...60...70...80...90...100 - done.


-- 
Andrey V. Kiselev
Home phone:  +7 812 5274898  ICQ# 26871517



More information about the Gdal-dev mailing list