Installing GDAL and OGR
GDAL (Geospatial Data Abstraction Library) is composed of two packages that come together: OGR handles geospatial vector file formats, including coordinate system transformations and vector operations. GDAL is the raster part of the library, and in version 1.11, it comes packed with 139 drivers that can read, and some even create rasters. GDAL also comes packed with functions for raster transformations and calculations such as resizing, clipping, reprojecting, and so on.
In the following tables, there's an excerpt of the list of GDAL and OGR drivers with the most common formats that you may find:
Long format name |
Code |
Creation |
---|---|---|
Arc/Info ASCII Grid |
|
Yes |
Arc/Info Export E00 GRID |
|
No |
ENVI .hdr Labelled Raster |
|
Yes |
Generic Binary (.hdr Labelled) |
|
No |
Oracle Spatial GeoRaster |
|
Yes |
GSat File Format |
|
No |
Graphics Interchange Format (.gif) |
|
Yes |
GMT Compatible netCDF |
|
Yes |
GRASS ASCII Grid |
|
No |
Golden Software ASCII Grid |
|
Yes |
Golden Software Binary Grid |
|
Yes |
Golden Software Surfer 7 Binary Grid |
|
Yes |
TIFF / BigTIFF / GeoTIFF (.tif) |
|
Yes |
GXF (Grid eXchange File) |
|
No |
Erdas Imagine (.img) |
|
Yes |
JPEG JFIF (.jpg) |
|
Yes |
NOAA Polar Orbiter Level 1b Data Set (AVHRR) |
|
No |
NOAA NGS Geoid Height Grids |
|
No |
NITF |
|
Yes |
NTv2 Datum Grid Shift |
|
Yes |
PCI .aux Labelled |
|
Yes |
PCI Geomatics Database File |
|
Yes |
PCRaster |
|
Yes |
Geospatial PDF |
|
Yes |
NASA Planetary Data System |
|
No |
Portable Network Graphics ( |
|
Yes |
R Object Data Store |
|
Yes |
Raster Matrix Format ( |
|
Yes |
RadarSat2 XML ( |
|
No |
Idrisi Raster |
|
Yes |
SAGA GIS Binary format |
|
Yes |
USGS SDTS DEM (*CATD.DDF) |
|
No |
SGI Image Format |
|
Yes |
SRTM HGT Format |
|
Yes |
Terragen Heightfield ( |
|
Yes |
USGS ASCII DEM / CDED ( |
|
Yes |
ASCII Gridded XYZ |
|
Yes |
The following table describes the OGR drivers:
Format name |
Code |
Creation |
---|---|---|
Arc/Info Binary Coverage |
|
No |
Arc/Info .E00 (ASCII) Coverage |
|
No |
AutoCAD DXF |
|
Yes |
Comma Separated Value ( |
|
Yes |
ESRI Shapefile |
|
Yes |
GeoJSON |
|
Yes |
Géoconcept Export |
|
Yes |
GeoRSS |
|
Yes |
GML |
|
Yes |
GMT |
|
Yes |
GPSBabel |
|
Yes |
GPX |
|
Yes |
GPSTrackMaker ( |
|
Yes |
Hydrographic Transfer Format |
|
No |
Idrisi Vector ( |
|
No |
KML |
|
Yes |
Mapinfo File |
|
Yes |
Microstation DGN |
|
Yes |
OpenAir |
|
No |
ESRI FileGDB |
|
No |
PCI Geomatics Database File |
|
Yes |
Geospatial PDF |
|
Yes |
PDS |
|
No |
PostgreSQL SQL dump |
|
Yes |
U.S. Census TIGER/Line |
|
No |
Note
You can find the full GDAL and OGR API documentation and the complete list of drivers at http://gdal.org/python/.
Windows
Again, we will use a wheel for the installation. Repeat the same procedure as before:
- Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/.
- Now, search for GDAL and download the file named
GDAL‑1.11.3‑cp27‑none‑win32.whl
. - Finally, install it with
pip
, as we did before.
Ubuntu Linux
Perform the following steps:
- Go to the terminal or open a new one.
- Then, enter the following command:
sudo apt-get install python-gdal