[GRASSLIST:2031] MrSID conversion

Does anyone happen to know of a good conversion utility for MrSID files so that I can import some ortho photos into GRASS? I found one called mrsiddecode, but it doesnt use the projection information in the header file, making it virtually useless.

Thanks for any suggestions,
C.
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia

At 04:42 PM 12/11/2003, you wrote:

Does anyone happen to know of a good conversion utility for MrSID files so that I can import some ortho photos into GRASS? I found one called mrsiddecode, but it doesnt use the projection information in the header file, making it virtually useless.

Are you referring to geo-referencing information in the .sid file or in the .sdw file? Geo-referencing information in the .sid is pretty new and I do not know of any software that reads it, but if you are referring to the .sdw 'world file', just rename it .tfw.

Regards

Richard W. Greenwood, PLS
Greenwood Mapping, Inc.
Rich <at> GreenwoodMap <dot> com
(307) 733-0203
http://www.GreenwoodMap.com

On Dec 11, 2003, at 7:49 PM, Richard Greenwood wrote:

At 04:42 PM 12/11/2003, you wrote:

Does anyone happen to know of a good conversion utility for MrSID files so that I can import some ortho photos into GRASS? I found one called mrsiddecode, but it doesnt use the projection information in the header file, making it virtually useless.

Are you referring to geo-referencing information in the .sid file or in the .sdw file? Geo-referencing information in the .sid is pretty new and I do not know of any software that reads it, but if you are referring to the .sdw 'world file', just rename it .tfw.

Thanks, I tried that, but the same result. If I run gdalinfo on the resultant tif file, I get:

Driver: GTiff/GeoTIFF
Size is 10687, 14660
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0,14660.0)
Upper Right (10687.0, 0.0)
Lower Right (10687.0,14660.0)
Center ( 5343.5, 7330.0)
Band 1 Block=10687x1 Type=Byte, ColorInterp=Gray

Not very useful!
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia

Does anyone happen to know of a good conversion utility for MrSID
files so that I can import some ortho photos into GRASS? I found one
called mrsiddecode, but it doesnt use the projection information in
the header file, making it virtually useless.

Did you try compiling GDAL with MrSID support? Then just r.in.gdal ..

http://www.remotesensing.org/gdal/frmt_mrsid.html

[gdal] $ ./configure --help | grep MrSID
  --with-mrsid=ARG Include MrSID support (ARG=path to MrSID DSDK or no)

[requires non-free software]

Hamish

Christopher Fonnesbeck wrote:

On Dec 11, 2003, at 7:49 PM, Richard Greenwood wrote:

At 04:42 PM 12/11/2003, you wrote:

Does anyone happen to know of a good conversion utility for MrSID files so that I can import some ortho photos into GRASS? I found one called mrsiddecode, but it doesnt use the projection information in the header file, making it virtually useless.

Are you referring to geo-referencing information in the .sid file or in the .sdw file? Geo-referencing information in the .sid is pretty new and I do not know of any software that reads it, but if you are referring to the .sdw 'world file', just rename it .tfw.

Thanks, I tried that, but the same result. If I run gdalinfo on the resultant tif file, I get:

Driver: GTiff/GeoTIFF
Size is 10687, 14660
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0,14660.0)
Upper Right (10687.0, 0.0)
Lower Right (10687.0,14660.0)
Center ( 5343.5, 7330.0)
Band 1 Block=10687x1 Type=Byte, ColorInterp=Gray

Not very useful!
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia

That doesn't make sense to me. You have a x.tif and an x.tfw, right? x.tif came out of some mrsid conversion and x.tfw is the original .sdw renamed to x.tfw?

If my assumptions above are correct then look at the x.tfw and make sure it has coordinates (5th and 6th lines). And if it does, then I am guessing that there is a bad geo-tiff header in x.tif. Use any simple image processing to open, and then re-save x.tif. (By 'simple' image processing I mean something that doesn't try to read a geo-tiff header) This will remove the bad geo-tiff header in x.tif and force gdal to read the world file (x.tfw). At which point you should be able to do r.in.gdal -oe x.tif out=x

Richard

On Thu, Dec 11, 2003 at 06:42:26PM -0500, Christopher Fonnesbeck wrote:

Does anyone happen to know of a good conversion utility for MrSID files
so that I can import some ortho photos into GRASS? I found one called
mrsiddecode, but it doesnt use the projection information in the header
file, making it virtually useless.

There is hope: gdal_translate.

Example: Spearfish aerial images in MrSID format, e.g. from
http://data.geocomm.com/catalog/US/61050/326/group129-3.html
Spearfish, SD (44103d7)
Deadwood South, SD (44103c6)

mrsiddecode -tif -input i44103d7_a.sid -output i44103d7_a.tif
gdalinfo i44103d7_a.tif
#[reports what you have seen, missing coordinate system]

#Assigning a Spatial Reference System (a_srs) to fix the missing raster map
#projection info (UTM/NAD83), get info from MrSID header file:

#check EPSG file: /usr/local/share/proj/epsg for EPSG code:
gdal_translate -of GTIFF -a_srs '+init=epsg:26913' \
               i44103d7_a.tif i44103d7_a_NAD83.tif

gdalinfo i44103d7_a_NAD83.tif
#reports NAD83 now, file fixed.

#Reprojecting maps ("warping") to different projection/geodetic datum
#(UTM/NAD27) to make ready for Spearfish location import:

gdalwarp -t_srs '+init=epsg:26713' i44103d7_a_NAD83.tif \
                 i44103d7_a_NAD27.tif

gdalinfo i44103d7_a_NAD27.tif

#in Spearfish sample dataset
r.in.gdal in=i44103d7_a_NAD27.tif out=i44103d7

I recommend to use GDAL from CVS.
Hope this helps,

Markus

--
Markus Neteler <neteler@itc.it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy