[GRASSLIST:8201] MrSID and incorporating the .sdw info into resulting GeoTiff.

I have a bunch of .sid files that I am converting to GeoTiffs. How
does one incorporate the spatial location information in their
associated .sdw file into the associate .tiff file?

Here's what I am doing:

mrsiddecode -i FILE.sid -o FILE.tif -of tifg
    
## Use the code for NAD27, Zone 12
## contained in EPSG file: /usr/share/proj/epsg
    
gdal_translate -of GTIFF -a_srs '+init=epsg:26712' \
  FILE.tif FILE.NAD27.tif

But when I do a gdalinfo, it is clear that the information in the .sdw
file has not been used (the "file.sdw" is given below):

gdalinfo file.tif
Driver: GTiff/GeoTIFF
Size is 9168, 9168
Coordinate System is:
PROJCS["NAD27 / UTM zone 12N",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.9786982138982,
                AUTHORITY["EPSG","7008"]],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0],
        UNIT["degree (supplier to define
representation)",0.01745329251994328],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-111],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","26712"]]
Origin = (-0.500000,9167.500000)
Pixel Size = (1.00000000,-1.00000000)
Corner Coordinates:
Upper Left ( -0.500, 9167.500) (115d29'19.33"W, 0d 4'57.69"N)
Lower Left ( -0.5000000, -0.5000000) (115d29'19.32"W, 0d 0'0.02"S)
Upper Right ( 9167.500, 9167.500) (115d24'23.63"W, 0d 4'57.72"N)
Lower Right ( 9167.500, -0.500) (115d24'23.61"W, 0d 0'0.02"S)
Center ( 4583.500, 4583.500) (115d26'51.47"W, 0d 2'28.84"N)

----------------------------------------------

The associated .sdw file is:
             1.200000000000000
             0.000000000000000
             0.000000000000000
            -1.200000000000000
        492501.000000000000000
       6243621.000000000000000

On 9/7/05, Craig Aumann <caumann@ualberta.ca> wrote:

I have a bunch of .sid files that I am converting to GeoTiffs. How
does one incorporate the spatial location information in their
associated .sdw file into the associate .tiff file?

Here's what I am doing:

mrsiddecode -i FILE.sid -o FILE.tif -of tifg

## Use the code for NAD27, Zone 12
## contained in EPSG file: /usr/share/proj/epsg

gdal_translate -of GTIFF -a_srs '+init=epsg:26712' \
        FILE.tif FILE.NAD27.tif

But when I do a gdalinfo, it is clear that the information in the .sdw
file has not been used (the "file.sdw" is given below):

gdalinfo file.tif
Driver: GTiff/GeoTIFF
Size is 9168, 9168
Coordinate System is:
PROJCS["NAD27 / UTM zone 12N",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.9786982138982,
                AUTHORITY["EPSG","7008"]],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0],
        UNIT["degree (supplier to define
representation)",0.01745329251994328],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-111],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","26712"]]
Origin = (-0.500000,9167.500000)
Pixel Size = (1.00000000,-1.00000000)
Corner Coordinates:
Upper Left ( -0.500, 9167.500) (115d29'19.33"W, 0d 4'57.69"N)
Lower Left ( -0.5000000, -0.5000000) (115d29'19.32"W, 0d 0'0.02"S)
Upper Right ( 9167.500, 9167.500) (115d24'23.63"W, 0d 4'57.72"N)
Lower Right ( 9167.500, -0.500) (115d24'23.61"W, 0d 0'0.02"S)
Center ( 4583.500, 4583.500) (115d26'51.47"W, 0d 2'28.84"N)

----------------------------------------------

The associated .sdw file is:
             1.200000000000000
             0.000000000000000
             0.000000000000000
            -1.200000000000000
        492501.000000000000000
       6243621.000000000000000

Try renaming the .sdw file to .tfw

Also try gdalinfo on the file.tif to be sure that the original reference system
is "seen".

Regards,
--
Richard Greenwood
richard.greenwood@gmail.com
www.greenwoodmap.com

On Wed, Sep 07, 2005 at 05:46:00PM -0600, we recorded a bogon-computron collision of the <caumann@ualberta.ca> flavor, containing:

I have a bunch of .sid files that I am converting to GeoTiffs. How
does one incorporate the spatial location information in their
associated .sdw file into the associate .tiff file?

Rename (or copy) the .sdw file to have the same name as the .tif you created,
but with a .tfw suffix. gdal_translate will know that it's the world file
associated with your tif and use it.

I.e.
mrsiddecode -i FILE.sid -o FILE.tif -of tifg
cp FILE.sdw FILE.tfw
gdal_translate -of GTIFF -a_srs '+init=epsg:26712' \
        FILE.tif FILE.NAD27.tif

--
Tom Russo KM5VY SAR502 DM64ux http://www.swcp.com/~russo/
Tijeras, NM QRPL#1592 K2#398 SOC#236 AHTB#1
"The only thing you can do easily is be wrong, and that's hardly
  worth the effort." -- Norton Juster

Even easier - use the -wf option in mrsiddecode:

mrsiddecode -i FILE.sid -o FILE.tif -wf -of tifg

And if the mrsiddecode geotif output is broken like this, why use geotif at all at this step? Just drop the '-of tifg' option and let gdal_translate create the geotif.

On Sep 8, 2005, at 10:15 AM, Tom Russo wrote:

On Wed, Sep 07, 2005 at 05:46:00PM -0600, we recorded a bogon-computron collision of the <caumann@ualberta.ca> flavor, containing:

I have a bunch of .sid files that I am converting to GeoTiffs. How
does one incorporate the spatial location information in their
associated .sdw file into the associate .tiff file?

Rename (or copy) the .sdw file to have the same name as the .tif you created,
but with a .tfw suffix. gdal_translate will know that it's the world file
associated with your tif and use it.

I.e.
mrsiddecode -i FILE.sid -o FILE.tif -of tifg
cp FILE.sdw FILE.tfw
gdal_translate -of GTIFF -a_srs '+init=epsg:26712' \
        FILE.tif FILE.NAD27.tif

-----
William Kyngesburye <kyngchaos@kyngchaos.com>
http://www.kyngchaos.com/

All generalizations are dangerous, even this one.

Thanks for everyone's responses here! It turns out that:

mrsiddecode -wf -input FILE.sid -output FILE.tif

cp FILE.sdw FILE.tfw

gdal_translate -of GTIFF -a_srs '+init=epsg:26712' FILE.tif
FILE.NAD27.tif

does the right thing, but simply changing the first line to:

mrsiddecode -of tifg -input FILE.sid -output FILE.tif

causes the translation to fail (i.e., not read the .tfw file).
I have no idea why this is the case. In the first case, given that
mrsiddecode generates a tfw file, is the resulting FILE.tif now storing
a link to this file that it lacks in the second case (using -of tifg)?

I'm running:

mrsiddecode -v
mrsiddecode: mrsid decoder tool
Version 4.0.10.720.Bob_713_br
Built Oct 12 2004 16:28:22 (linux, gcc3, release)

Gdal_translate:
GDAL 1.2.1.0, released 2004/06/23

Thanks again for you help!
Craig

You don't need the 'cp FILE.sdw FILE.tfw' step - that's what the -wf mrsid option does.

Also, what about using the v5 mrsid DSDK release? Maybe the geotif bug is fixed there.

On Sep 8, 2005, at 11:57 AM, Craig Aumann wrote:

Thanks for everyone's responses here! It turns out that:

mrsiddecode -wf -input FILE.sid -output FILE.tif

cp FILE.sdw FILE.tfw

gdal_translate -of GTIFF -a_srs '+init=epsg:26712' FILE.tif
FILE.NAD27.tif

does the right thing, but simply changing the first line to:

mrsiddecode -of tifg -input FILE.sid -output FILE.tif

causes the translation to fail (i.e., not read the .tfw file).
I have no idea why this is the case. In the first case, given that
mrsiddecode generates a tfw file, is the resulting FILE.tif now storing
a link to this file that it lacks in the second case (using -of tifg)?

I'm running:

mrsiddecode -v
mrsiddecode: mrsid decoder tool
Version 4.0.10.720.Bob_713_br
Built Oct 12 2004 16:28:22 (linux, gcc3, release)

Gdal_translate:
GDAL 1.2.1.0, released 2004/06/23

Thanks again for you help!
Craig

-----
William Kyngesburye <kyngchaos@kyngchaos.com>
http://www.kyngchaos.com/

"Oh, look, I seem to have fallen down a deep, dark hole. Now what does that remind me of? Ah, yes - life."

- Marvin