Building GDAL on Linux: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) |
||
Line 80: | Line 80: | ||
./configure --with-python --with-poppler=yes \ | ./configure --with-python --with-poppler=yes \ | ||
--with-mrsid=$HOME/src/MrSID/Raster_DSDK \ | --with-mrsid=$HOME/src/MrSID/Raster_DSDK \ | ||
--with- | --with-openjpeg --with-geos | ||
make | make | ||
sudo make install | sudo make install |
Revision as of 00:09, 18 March 2011
JPEG2000
Options for JPEG2000 support include
- LizardTech MrSID SDK (--with-jp2mrsid) (costs money to use encoder)
- Jasper (--with-jasper)
- Kakadu (commercial license "if you have to ask...") http://www.kakadusoftware.com/
- OpenJPEG (--with-openjpeg)
Which is best??
OpenJPEG
Version 1.4 does not work! You have to use the development branch via SVN
cd JPEG2000 svn co http://openjpeg.googlecode.com/svn/branches/v2 cd v2 make
Jasper
You want the Jasper from the remotesensing site, not the official one. It has support for something called GeoJP2
ftp://ftp.remotesensing.org/pub/gdal/
Building gdal on my 64-bit Debian system required this
cd jasper src dir export CFLAGS="-fPIC -m64" ./configure make; sudo make install unset CFLAGS sudo ldconfig
MrSID
Go to http://developer.lizardtech.com/ and sign up, and download the DSDK. Unpack it someplace convenient then tell gdal configure where to find it.
16-Mar-2011 GDAL build
Latest gdal on Ubuntu is 1.7.3 so I am building 1.8.0 to get support for Geospatial PDF files, which was added in the 1.8.0 release. (Regarding Geospatial PDF, see http://www.gdal.org/frmt_pdf.html -- there are links to further documentation and sample GeoPDF's at the bottom of this page.)
I downloaded source tarball from gdal.org.
This configure command gets me what I need (there are many more options). (I would also like to set up support for MrSID and ESRI File Geodatabases. Not today though...)
Poppler is for PDF support
# First install required prerequisite packages for UBUNTU sudo apt-get install libproj-dev libpoppler-dev
# ...or for DEBIAN, I am running "lenny" with backports to get this sudo apt-get -t lenny-backports install proj libpoppler3 libpoppler-dev
MrSID
I manually copied the libraries into /usr/local/lib and the binaries into /usr/local/bin -- Maybe I could have done the install using a script but I was too lazy to dig through their SDK to figure out how.
GEOS
cd geos3.2.2 ./configure make sudo make install cd ..
I had some trouble because the GDAL build kept seeing the MrSID tools -- the $ ones, not the SDK. MrSID uses GEOS, too, but an outdated version. Make sure your environment is not set to expose the old library to the whole system.
Building GDAL (remember? that's what we are trying to do!)
cd ~/src/ wget http://download.osgeo.org/gdal/gdal-1.8.0.tar.gz tar xzvf gdal-1.8.0.tar.gz cd gdal-1.8.0 ./configure --with-python --with-poppler=yes \ --with-mrsid=$HOME/src/MrSID/Raster_DSDK \ --with-openjpeg --with-geos make sudo make install
Here we go! Does it work?
% gdalinfo 1501ANC4815_geo.pdf Driver: PDF/Geospatial PDF Files: 1501ANC4815_geo.pdf Size is 4470, 3375 Coordinate System is: PROJCS["UTM Zone 48, Northern Hemisphere", GEOGCS["Indian 1960", DATUM["Indian_1960", SPHEROID["Everest 1830 (1937 Adjustment)",6377276.345,300.8017, AUTHORITY["EPSG","7015"]], TOWGS84[198,881,317,0,0,0,0], AUTHORITY["EPSG","6131"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4131"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",105], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["Meter",1]] GeoTransform = 429999.053008, 42.34642896, 0.04051872 999725.914982, 0.04124303999999999, -42.332688 Metadata: NEATLINE=POLYGON ((445035.80158801417565 999277.556482305750251,444993.235997625160962 991902.349403560161591,444864.738057852664497 884201.712978136376478,452159.580137342331 884208.817744017927907,585964.54743435990531 884289.527591207530349,614300.221590773784555 884383.269830735283904,614190.235319046885706 999293.477391553344205,605175.140901734353974 999218.552309990860522,553978.789515793323517 999300.979716640315019,505958.457250406034291 999353.427943945163861,451172.635888226970565 999382.750743734533899,445035.722449889173731 999360.237513555795886,445035.80158801417565 999277.556482305750251,445035.80158801417565 999277.556482305750251,445035.80158801417565 999277.556482305750251)) Corner Coordinates: Upper Left ( 429999.053, 999725.915) (104d21'46.72"E, 9d 2'39.27"N) Lower Left ( 430135.804, 856853.093) (104d21'58.76"E, 7d45' 6.78"N) Upper Right ( 619287.590, 999910.271) (106d 5' 7.80"E, 9d 2'41.48"N) Lower Right ( 619424.341, 857037.449) (106d 4'59.36"E, 7d45' 9.52"N) Center ( 524711.697, 928381.682) (105d13'28.20"E, 8d23'57.68"N) Band 1 Block=4470x1 Type=Byte, ColorInterp=Red Band 2 Block=4470x1 Type=Byte, ColorInterp=Green Band 3 Block=4470x1 Type=Byte, ColorInterp=Blue
JOY! It works!
To see if it built all them nifty formats, for real, you can check:
% gdalinfo --formats Supported Formats: VRT (rw+v): Virtual Raster GTiff (rw+v): GeoTIFF NITF (rw+v): National Imagery Transmission Format RPFTOC (rov): Raster Product Format TOC format HFA (rw+v): Erdas Imagine Images (.img) SAR_CEOS (rov): CEOS SAR Image CEOS (rov): CEOS Image JAXAPALSAR (ro): JAXA PALSAR Product Reader (Level 1.1/1.5) GFF (rov): Ground-based SAR Applications Testbed File Format (.gff) ELAS (rw+): ELAS AIG (rov): Arc/Info Binary Grid AAIGrid (rwv): Arc/Info ASCII Grid SDTS (rov): SDTS Raster DTED (rwv): DTED Elevation Raster PNG (rwv): Portable Network Graphics JPEG (rwv): JPEG JFIF MEM (rw+): In Memory Raster JDEM (ro): Japanese DEM (.mem) GIF (rwv): Graphics Interchange Format (.gif) BIGGIF (rov): Graphics Interchange Format (.gif) ESAT (ro): Envisat Image Format BSB (rov): Maptech BSB Nautical Charts XPM (rwv): X11 PixMap Format BMP (rw+v): MS Windows Device Independent Bitmap DIMAP (rov): SPOT DIMAP AirSAR (ro): AirSAR Polarimetric Image RS2 (ro): RadarSat 2 XML Product PCIDSK (rw+v): PCIDSK Database File PCRaster (rw): PCRaster Raster File ILWIS (rw+v): ILWIS Raster Map SGI (rw+): SGI Image File Format 1.0 SRTMHGT (rwv): SRTMHGT File Format Leveller (rw+): Leveller heightfield Terragen (rw+): Terragen heightfield ISIS3 (rov): USGS Astrogeology ISIS cube (Version 3) ISIS2 (rov): USGS Astrogeology ISIS cube (Version 2) PDS (rov): NASA Planetary Data System TIL (ro): EarthWatch .TIL ERS (rw+): ERMapper .ers Labelled JPEG2000 (rwv): JPEG-2000 part 1 (ISO/IEC 15444-1) L1B (ro): NOAA Polar Orbiter Level 1b Data Set FIT (rwv): FIT Image GRIB (rov): GRIdded Binary (.grb) MrSID (ro): Multi-resolution Seamless Image Database (MrSID) JP2MrSID (ro): MrSID JPEG2000 RMF (rw+): Raster Matrix Format WCS (ro): OGC Web Coverage Service WMS (ro): OGC Web Map Service MSGN (ro): EUMETSAT Archive native (.nat) RST (rw+): Idrisi Raster A.1 INGR (rw+v): Intergraph Raster GSAG (rw): Golden Software ASCII Grid (.grd) GSBG (rw+): Golden Software Binary Grid (.grd) GS7BG (ro): Golden Software 7 Binary Grid (.grd) COSAR (ro): COSAR Annotated Binary Matrix (TerraSAR-X) TSX (ro): TerraSAR-X Product COASP (ro): DRDC COASP SAR Processor Raster R (rwv): R Object Data Store PNM (rw+): Portable Pixmap Format (netpbm) DOQ1 (ro): USGS DOQ (Old Style) DOQ2 (ro): USGS DOQ (New Style) ENVI (rw+v): ENVI .hdr Labelled EHdr (rw+v): ESRI .hdr Labelled GenBin (ro): Generic Binary (.hdr Labelled) PAux (rw+): PCI .aux Labelled MFF (rw+): Vexcel MFF Raster MFF2 (rw+): Vexcel MFF2 (HKV) Raster FujiBAS (ro): Fuji BAS Scanner Image GSC (ro): GSC Geogrid FAST (ro): EOSAT FAST Format BT (rw+): VTP .bt (Binary Terrain) 1.3 Format LAN (rov): Erdas .LAN/.GIS CPG (ro): Convair PolGASP IDA (rw+): Image Data and Analysis NDF (ro): NLAPS Data Format EIR (rov): Erdas Imagine Raw DIPEx (ro): DIPEx LCP (rov): FARSITE v.4 Landscape File (.lcp) GTX (rw+v): NOAA Vertical Datum .GTX LOSLAS (rov): NADCON .los/.las Datum Grid Shift NTv2 (rw+v): NTv2 Datum Grid Shift RIK (ro): Swedish Grid RIK (.rik) USGSDEM (rw): USGS Optional ASCII DEM (and CDED) GXF (ro): GeoSoft Grid Exchange Format HTTP (ro): HTTP Fetching Wrapper NWT_GRD (ro): Northwood Numeric Grid Format .grd/.tab NWT_GRC (ro): Northwood Classified Grid Format .grc/.tab ADRG (rw+v): ARC Digitized Raster Graphics SRP (rov): Standard Raster Product (ASRP/USRP) BLX (rw): Magellan topo (.blx) Rasterlite (rw): Rasterlite PostGISRaster (ro): PostGIS Raster driver SAGA (rw+v): SAGA GIS Binary Grid (.sdat) KMLSUPEROVERLAY (rwv): Kml Super Overlay XYZ (rwv): ASCII Gridded XYZ HF2 (rwv): HF2/HFZ heightfield raster OZI (rov): OZI
...all the right stuff!
Now back to Mapping Vietnam
01-Dec-2010
Building gdal 1.7.3 so I can have gdal python bindings, so I can reclassify a raster. In another window, I am running a very simple ESRI Spatial Analyst reclassification, but it's taking so long that I can probably build gdal and write a python script to do the same thing before the ESRI tool completes.
(I assume the ESRI tool crashed but as usual, I have no way of knowing.)
I had to add C++ to my system. Compiling.
Oh -- gdal built successfully. Installing it. Done. Updated system path.
Trying to build Python bindings now, what a pain! In the meantime, I clicked "cancel" button, perhaps in a few hours I will know if ArcMap crashed or not. (See comment above about failure of cancel button to cancel...)