Version 6 (modified by 12 years ago) ( diff ) | ,
---|
How to add MrSID support into GDAL
Multiresolution Seamless Image Database (MrSID) is a proprietary image format that is commonly used for publicly available image data. Currently, free software is not available for decoding MrSID images. The patent holder for MrSID compression, LizardTech, makes a decoder available as part of their Software Development Kit (SDK), but LizardTech's licensing terms do not allow distribution of a compiled form of the decoder. Thus, although it is possible to use the SDK to add support for MrSID images to the Geospatial Data Abstraction Library (GDAL), and thus to all of the packages that rely on GDAL such as GRASS and qGIS), to do so it is necessary to compile a module. The UbuntuGIS project has simplified the process of adding MrSID support into GDAL, for users that need it.
If you have not already, add the Ubuntu GIS repository to apt sources list. See this page for instructions: Adding Ubuntu GIS repository to your system's software sources
1. Installing the SDK
Download the software development kit (SDK) from LizardTech, the company that owns the MrSID patents. Go to this web site (http://www.lizardtech.com/developer/ ), register for a developer account (which is free of charge), and download the version of the Linux SDK that matches your architecture (32 bit or 64 bit) and your version of the Gnu C Compiler (gcc) – for recent Ubuntu distributions (8.04, 8.10, 9.04) the gcc 4.1 versions will work.
The SDK is distributed as a tarball. The current version as of this writing is 7.0.0 build 2167. The file (called Geo-DSDK-7.0.0.2167.linux.x86.gcc41.tar.gz for the 32 bit, gcc 4.1 version) can be extracted to any local directory, such as your $HOME directory. To extract to your $HOME directory, open a terminal and type:
cd tar -zxvf Geo-DSDK-7.0.0.2167.linux.x86.gcc41.tar.gz .
This will create a directory called Geo_DSDK-7.0.0.2167, containing the SDK.
2. Installing packages
In a terminal, type:
sudo apt-get update sudo apt-get install libgdal-mrsid-src sudo apt-get install gdal-bin
The first command will ensure that you have the current list of packages available in the repository. The second command will install the gdal-mrsid-src package (the mrsid source package) and its dependencies to compile the plugin. The third command installs the gdal-bin package, which includes gdalinfo, a utility you will use to confirm that MrSID support has been successfully added to GDAL.
3. Building the plugin
In a terminal, type:
sudo gdal-build-mrsid $HOME/Geo_DSDK-7.0.0.2167 or sudo gdal-mrsid-build $HOME/Geo_DSDK-7.0.0.2167
This command is a script that unzips the source files for the gdal MrSID module (installed in step 3), and builds the module using the LizardTech SDK. You will see output on the terminal as the configure script and compiler run, and if compilation is successful the final line of output will read “cp gdal_MrSID.so /usr/lib/gdal16plugins”.
4. Testing the plugin
To test that MrSID support is now available, run:
gdalinfo --formats | grep -i mrsid
You should see "MrSID (ro): Multi-resolution Seamless Image Database (MrSID)" and "JP2MrSID (ro): MrSID JPEG2000". These lines indicate that both MrSID and JPEG2000 support have been added to GDAL (note that there is a free software implementation of JPEG2000 support through the Jasper library, but support for JPEG2000 is also available using the LizardTech SDK).
Example images are distributed with the SDK – you can further check whether compilation was successful with:
gdalinfo $HOME/Geo_DSDK-7.0.0.2167/examples/data/meg_cr20.sid gdalinfo $HOME/Geo_DSDK-7.0.0.2167/examples/data/meg_cr20.jp2
If all is well, these commands should output characteristics of the images to the terminal.
Now that the module has been compiled, any program that uses GDAL should be able to read MrSid files. For example, qGIS should now be able to display and use *.sid and *.jp2 files, and r.in.gdal in GRASS should now be able to import them to GRASS raster formats. QGIS extensions also work with these formats (e.g. the Point Sampling Tool extension can extract data from *.sid and *.jp2 images, and the images can be passed to R using the ManageR extension).
Bill Kristan