GDAL

Using GDAL

AcuGIS Suite enables GDAL as part of the installation process.

 

GDAL command line operations can be divided into two components.

1. Vector Operations (ogr2ogr)

2. Raster Operations (gdal_translate)

 

ogr2ogr:

 

root@geohelm:~# ogr2ogr --help-general
Generic GDAL/OGR utility command options:
  --version: report version of GDAL/OGR in use.
  --license: report GDAL/OGR license info.
  --formats: report all configured format drivers.
  --optfile filename: expand an option file into the argument list.
  --config key value: set system configuration option.
  --debug [on/off/value]: set debug level.
  --pause: wait for user input, time to attach debugger
  --locale [locale]: install locale for debugging (ie. en_US.UTF-8)
  --help-general: report detailed help on general options.
root@geohelm:~#

 

ogrinfo:

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

gdal_translate:

Usage: gdal_translate [--help-general] [--long-usage]
       [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
             CInt16/CInt32/CFloat32/CFloat64}] [-strict]
       [-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]
       [-outsize xsize[%] ysize[%]]
       [-unscale] [-scale [src_min src_max [dst_min dst_max]]]
       [-srcwin xoff yoff xsize ysize] [-projwin ulx uly lrx lry] [-epo] [-eco]
       [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]
       [-gcp pixel line easting northing [elevation]]*
       [-mo "META-TAG=VALUE"]* [-q] [-sds]
       [-co "NAME=VALUE"]* [-stats]
       src_dataset dst_dataset		   

 

gdal_info:

root@geohelm:~# gdalinfo
Usage: gdalinfo [--help-general] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
                [-norat] [-noct] [-nofl] [-checksum] [-proj4] [-mdd domain]*
                [-sd subdataset] datasetname 

 

Important: the operations available will be limited by the drivers installed.

 

To list available drivers, use:

 

root@geohelm:~# ogr2ogr --formats

and:

root@geohelm:~# gdal_translate --formats

 

Troubleshooting:

If the above commands produce 'ogr2ogr command not found' or 'gdal_translate command not found', do the following:

On Debian or Ubuntu:

root@geohelm:~# apt-get install gdal-bin

On CentOS

root@geohelm:~# yum install gdal-libs

On Fedora

root@geohelm:~# dnf install gdal-libs

 

Below are excellent resources to get started with ogr2ogr and gdal_translate:

Boston GIS ogr2ogr CheatSheet

Derek Watkins GDAL Cheatsheet

GDAL Website

 

Next Up: Tomcat Structure

Tomcat Directory Structure