Building GDAL on Linux: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) |
||
Line 10: | Line 10: | ||
Which is best?? | Which is best?? | ||
You can download and build '''openjpeg''' and install it but alas GDAL does not recognize it. '''It DOES find Jasper''' though so I am trying that. | |||
You want the Jasper from the remotesensing site, not the official one. | 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/ | ftp://ftp.remotesensing.org/pub/gdal/ |
Revision as of 02:32, 17 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??
You can download and build openjpeg and install it but alas GDAL does not recognize it. It DOES find Jasper though so I am trying that.
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/
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
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-jasper=/usr/local \ --with-geos=/usr/local 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 do
gdalinfo --formats
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...)