using gdal in your gis workflow

17
Using GDAL in Your GIS Workflow: An OSGeo Approach

Upload: gerry-james

Post on 10-May-2015

2.972 views

Category:

Documents


0 download

DESCRIPTION

The accompanying slide show to a webinar I gave back in July 2009 on using GDAL in any existing GIS workflow.

TRANSCRIPT

Page 1: Using GDAL In Your GIS Workflow

Using GDAL in Your GIS Workflow:

An OSGeo Approach

Page 2: Using GDAL In Your GIS Workflow

A little about me... President and Lead Consultant at Carteryx 15 years experience using geospatial

technologies Involved in forestry, mining, engineering,

environmental and many other sectors... Have used open source GIS for past 10 years GIS development and deployment specialist Experience in a number of software platforms GRASS

FW Tools Quantum GIS uDig

MapServer GeoServer OpenLayers Flamingo

Page 3: Using GDAL In Your GIS Workflow

Introduction A GIS is only as good as the data that goes in

to it... Preparing data can take time...time you may

not have GDAL utilities can run at command line or as

library Projection conversion, format conversion, sub-

set... Bindings for Python and dll’s for Visual Studio

Page 4: Using GDAL In Your GIS Workflow

Agenda What is GDAL? Acquiring and Installing GDAL and it’s

associated utilities Getting basic raster and vector information Converting between raster file types Converting between vector file types Basics of GDAL/OGR/OSR Python bindings Sample Python code to get metadata from

series of rasters

Page 5: Using GDAL In Your GIS Workflow

GEOSPATIAL DATA ABSTRACTION LIBRARY (GDAL) 3 major classes within the GDAL

libraries GDAL - Raster OGR – Vector OSR – Spatial Reference

What can they do Raster – coordinate system conversion

(warp), statistics, file type conversion, geo-processing (e.g. image merge

Vector – coordinate system conversion, file type conversion etc.

Spatial Ref. – manipulate spatial reference and convert coordinates etc.

Page 6: Using GDAL In Your GIS Workflow

File Types Raster

ArcInfo ASCII Raster Microsoft Bitmap ER Mapper Compressed Wavelets Oracle Spatial GeoRaster GeoTiff Many, many more... (see

http://www.gdal.org/formats_list.html) Vector

ArcInfo Binary Coverage ESRI Shapefile GeoRSS KML Many, many more... (see

http://www.gdal.org/ogr/ogr_formats.html)

Page 7: Using GDAL In Your GIS Workflow

Acquiring GDAL/OGR

Base versions http://fwtools.maptools.org/ http://trac.osgeo.org/osgeo4w/ (stack builder)

C/C++ and Python libraries etc.

Windows Dll’s gdal_csharp - ogr_csharp.dll – gdalconst_csharp – osr_csharphttp://fwtools.maptools.org/

SharpMaphttp://www.codeplex.com/SharpMap

Page 8: Using GDAL In Your GIS Workflow

For FWTools install - Run installer

OSGeo4W – run stack builder Two options (Express and Advanced) For Express you can pick from the 6

main packages (MapServer, QGIS, GDAL, Apache, uDig and OpenEV)

With Advanced you have many choices like the Cygwin installer.

Installing GDAL/OGR

Page 9: Using GDAL In Your GIS Workflow

Off we go to the demo....

Installing GDAL/OGR

Page 10: Using GDAL In Your GIS Workflow

Command Line Many commands available

ogr2ogr – convert between data types, coordinate systems etc.

gdalinfo – get summary or comprehensive metadata from raster data sets

gdaltindex – create a MapServer style raster index shapefile

gdaltransform – transform coordinates between spatial reference systems

Python scripts gdal_merge.py – quick merge of multiple raster

images to one image gdal2tiles.py – create multiple tiles from a single

raster gdal2xyz.py – create xyz text file from raster

Page 11: Using GDAL In Your GIS Workflow

Command Line Off we go to the demo...

Page 12: Using GDAL In Your GIS Workflow

GDAL Bindings in Python What are GDAL Python Bindings

GDAL/OGR/OSR libraries that are accessible to Python

Gives data manipulation capabilities to Python How do they work?

Calls to the libraries in the code... from osgeo.gdal import * or import osgeo.gdal as osr from osgeo.ogr import * or import osgeo.ogr as ogr from osgeo.osr import * or import osgeo.osr as osr

What is the big advantage? Batch processing and combining with built-in

python functions Math String Logic

Regular expressions Loops

Page 13: Using GDAL In Your GIS Workflow

GDAL Bindings in Python What can you do with bindings/dlls

GDAL Add bands Manipulate bands Create rasters Re-project rasters and more

OGR Geoprocessing (union, intersection, buffer etc.) Get information (dataset, layers, features) Re-project Change data type

Page 14: Using GDAL In Your GIS Workflow

Creating Our First Python/GDAL app Off we go to the demo...

Page 15: Using GDAL In Your GIS Workflow

Summary Why GDAL/OGR/OSR?

Open source and free A number of tools already available for command

line Integrates in many programming languages Many geoprocessing functions and objects

Why Python? Runs in many different environments (Windows –

Linux – Mac/OS) Well established programming language Integrates with Qt and other bindings to increase

flexibility and use

Page 16: Using GDAL In Your GIS Workflow

More Information

How to get more training.... Contact Carteryx @ [email protected] or

778.668.5025 More training classes to come (watch

http://www.carteryx.com) Pre-defined and Personalized training....

Links http://fwtools.maptools.org/ http://map.hut.fi/doc/Geo-GDAL/html/namespace_

geo.html http://trac.osgeo.org/osgeo4w/ http://www.python.org http://www.diveintopython.org/

Page 17: Using GDAL In Your GIS Workflow

More Information

Questions????