Reading Raster Data with GDAL - Utah State University
[Pages:53]Reading Raster Data with GDAL
Open Source RS/GIS Python Week 4
OS Python week 4: Reading raster data [1]
GDAL
? Supports about 100 raster formats
? ArcInfo grids, ArcSDE raster, Imagine, Idrisi, ENVI, GRASS, GeoTIFF
? HDF4, HDF5 ? USGS DOQ, USGS DEM ? ECW, MrSID ? TIFF, JPEG, JPEG2000, PNG, GIF, BMP ? See
OS Python week 4: Reading raster data [2]
Finding available formats
? To see what formats are compiled into your version of GDAL, use this command in the FWTools shell (or terminal window on a Mac)
gdalinfo --formats
OS Python week 4: Reading raster data [3]
Importing GDAL
? Need to import both gdal and gdalconst ? FWTools:
import gdal, gdalconst
? Not FWTools:
from osgeo import gdal, gdalconst
OS Python week 4: Reading raster data [4]
? All gdalconst constants start with a prefix which minimizes the possibility of conflicts with other modules
? Can import a module so you don't have to prefix things with the module name:
import gdal from gdalconst import *
or
from osgeo import gdal from osgeo.gdalconst import *
OS Python week 4: Reading raster data [5]
GDAL data drivers
? Similar to OGR data drivers ? Need to register a driver before using it ? Need to have a driver object before
creating a new raster data set ? Driver names (code) are available at
OS Python week 4: Reading raster data [6]
? Register all drivers at once
? Works for reading data but not for creating data sets
gdal.AllRegister()
? Get the Imagine driver and register it
? Works for reading and creating new Imagine files
driver = gdal.GetDriverByName('HFA') driver.Register()
OS Python week 4: Reading raster data [7]
Opening a raster data set
? Once the driver has been registered, the
Open(, )
method can be used to return a Dataset object
fn = 'aster.img' ds = gdal.Open(fn, GA_ReadOnly) if ds is None:
print 'Could not open ' + fn sys.exit(1)
OS Python week 4: Reading raster data [8]
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- c h a p ter file handling in 2 python
- file input and output and conditionals borenstein lab
- variables and simple data types
- reading external files into sas using a data step university of south
- python read file as string
- interaction between sas and python for data handling and visualization
- python activity 2 input and variables in python ioct
- python file i o cheat sheet michigan state university
- reading and writing data files with python astrophysics
- python tutorial reading and manipulating catalogs
Related searches
- utah state teaching license
- utah state teacher license
- utah state license search
- utah state drivers license
- utah state medical license lookup
- utah state swppp inspection form
- utah state department of education
- utah state board of nursing license
- utah state of education
- utah state board of nursing website
- utah state medical license
- utah state educator licensing