Installing GDAL/OGR on Ubuntu

GDAL/OGR is, hands down, the definitive toolset for Getting Things Done geospatially. It's a huge time saver, but it can take a lot of time to sort through all the possible installation methods. Once you figure it out, it's relatively painless; here's the process that works for me.


There are many, many ways to get GDAL/OGR for Ubuntu: I prefer using a reliable PPA that is updated frequently, installing the most recent GDAL/OGR version from the repository. Currently (as of Ubuntu 12.10 & GDAL 1.9.1) the best option I know of for this is ubuntugis (stable).

To get the latest GDAL/OGR version, add the PPA to your sources, then install the gdal-bin package (this should automatically grab any necessary dependencies, including at least the relevant libgdal version).

To do this:

$ sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update

Hit enter when prompted, then:

$ sudo apt-get install gdal-bin

To verify after installation, try:

$ ogrinfo

If the installation was successful, you will see something like this:

Usage: ogrinfo [--help-general] [-ro] [-q] [-where restricted_where]
               [-spat xmin ymin xmax ymax] [-fid fid]
               [-sql statement] [-al] [-so] [-fields={YES/NO}]
               datasource_name [layer [layer ...]]

That's it! You're good to go. If you're new to this toolset, you might want to continue on to Intro to Using OGR Part I: Exploring Data.

By @Sara Safavi