GDAL / OGR & Proj.4

GDAL / OGR & Proj.4

GDAL / OGR & Proj.4 Libraries and Utilities The technologies that we will discuss today are programming libraries and utility programs that have been built upon those libraries. In particular, we will discuss three libraries: • GDAL - the Geospatial Data Abstraction Library • Currently supports up to 57 raster formats for reading and/or writing. (http://www.gdal.org/formats_list.html) Released with 11 utility programs. (http://www.gdal.org/ • gdal_utilities.html) • OGR • Currently supports 23 vector formats for reading and/ or writing. (http://www.gdal.org/ogr/ogr_formats.html) Released with 3 utility programs. (http://www.gdal.org/ogr/ • ogr_utilities.html) Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 2 Libraries and Utilities (cont.) Proj.4 Cartographic Projections Library • > 123 supported projections • Released with three utilities. (http://proj.maptools.org/) GDAL and OGR provide the basis for data read/write capabilities to the Open Source applications that we are using in this class, while also supporting useful functionality through the utilities that are released with them. Similarly, Proj.4 is the foundation projection library for coordinate conversion within all of the geospatial applications used in this course. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 3 GDAL The development of both GDAL and OGR is led by Frank Warmerdam, with the number and types of data supported by these libraries increasing with each new release. While the specific file formats supported by GDAL and OGR depend upon which supporting libraries are used when the libraries are built, as many as 57 raster formats are currently supported by GDAL. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 4 GDAL - Formats The current list of GDAL’s supported raster formats may be obtained from the GDAL website (http://www.gdal.org/ formats_list.html), while the formats supported by a specific installation of GDAL may be obtained by executing the gdalinfo command with the optional --formats parameter. > gdalinfo --formats Supported Formats: VRT (rw+): Virtual Raster GTiff (rw+): GeoTIFF NITF (rw+): National Imagery Transmission Format HFA (rw+): Erdas Imagine Images (.img) . USGSDEM (rw): USGS Optional ASCII DEM (and CDED) GXF (ro): GeoSoft Grid Exchange Format GRASS (ro): GRASS Database Rasters (5.7+) Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 5 GDAL - Utilities gdalinfo is only one of 11 utility programs • gdalinfo - report information about a file. • gdal_translate - Copy a raster file, with control of output format. • gdaladdo - Add overviews to a file. • gdalwarp - Warp an image into a new coordinate system. • gdaltindex - Build a MapServer raster tileindex. • gdal_contour - Contours from DEM. • gdal_rasterize - Rasterize vectors into raster file. • gdal-config - Get options required to build software using GDAL. Two of which we will demonstrate here, several of which we will briefly cover later in the class. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 6 GDAL - Utilities (cont.) In addition to the compiled programs distributed with GDAL, three utility python scripts are also provided as part of the package: • rgb2pct.py - Convert a 24bit RGB image to 8bit paletted. • pct2rgb.py - Convert an 8bit paletted image to 24bit RGB. • gdal_merge.py - Build a quick mosaic from a set of images. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 7 GDAL - Utilities: Getting Help Getting help with the syntax of the various GDAL utilities can be accomplished several ways: • By typing the name of the command without any additional parameters, e.g. > gdalinfo Usage: gdalinfo [--help-general] [-mm] [-nogcp] [-nomd] datasetname • Also, by accessing the ‘man’ page for the command, e.g. > man gdalinfo • Documentation for the GDAL utilities may also be reviewed on GDAL’s web site: http://www.remotesensing.org/gdal/gdal_utilities.html Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 8 GDAL - gdalinfo gdalinfo provides detailed information about a supported raster dataset. • The syntax for the gdalinfo utility may be obtained by typing the command without any parameters. > gdalinfo Usage: gdalinfo [--help-general] [-mm] [-nogcp] [-nomd] datasetname • The parameters are as follows: - --help-general : display the general help for all GDAL utiility commands - -mm : force calculation of min/max values for each band - -nogcp, -nomd : suppress display of ground control points and metadata respectively. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 9 GDAL - gdalinfo The additional general (generic) GDAL parameters are: - --version: report version of GDAL in use. - --formats: report all configured format drivers. - --format [format]: details of one format. - --optfile filename: expand an option file into the argument list. - --config key value: set system configuration option. - --debug [on/off/value]: set debug level. - --help-general: report detailed help on general options. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 10 GDAL - gdalinfo - general information The following commands illustrate the execution of gdalinfo to acquire general information about GDAL without reference to a specific dataset. > gdalinfo --version GDAL 1.2.6.0, released 2005/03/13 > gdalinfo --formats Supported Formats: VRT (rw+): Virtual Raster GTiff (rw+): GeoTIFF etc. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 11 GDAL - gdalinfo - general information (cont.) > gdalinfo --format GTiff Format Details: Short Name: GTiff Long Name: GeoTIFF Extension: tif Mime Type: image/tiff Help Topic: frmt_gtiff.html Supports: Create() - Create writeable dataset. Supports: CreateCopy() - Create dataset by copying another. Creation Datatypes: Byte UInt16 Int16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64 <CreationOptionList> <Option name="COMPRESS" type="string-select"> <Value>NONE</Value> etc. Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 12 GDAL - gdalinfo - Dataset related commands gdalinfo really becomes useful when used to query a dataset for available information about that dataset. If used to query a dataset obtained from the USGS Seamless Data Delivery system for the National Elevation Dataset (NED, http:// seamless.usgs.gov/), the following results are obtained. > gdalinfo ned_27173141 Driver: AIG/Arc/Info Binary Grid Size is 2531, 1636 <continued> Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 13 GDAL - gdalinfo - Dataset related commands (cont.) > gdalinfo ned_27173141 <continuation> Coordinate System is: GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9108"]], AXIS["Lat",NORTH], AXIS["Long",EAST], AUTHORITY["EPSG","4269"]] <continued> Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 14 GDAL - gdalinfo - Dataset related commands (cont.) > gdalinfo ned_27173141 <continuation> Origin = (-106.983889,35.302778) Pixel Size = (0.00027778,-0.00027778) Corner Coordinates: Upper Left (-106.9838889, 35.3027778) (106d59'2.00"W, 35d18'10.00"N) Lower Left (-106.9838889, 34.8483334) (106d59'2.00"W, 34d50'54.00"N) Upper Right (-106.2808334, 35.3027778) (106d16'51.00"W, 35d18'10.00"N) Lower Right (-106.2808334, 34.8483334) (106d16'51.00"W, 34d50'54.00"N) Center (-106.6323611, 35.0755556) (106d37'56.50"W, 35d 4'32.00"N) Band 1 Block=512x4 Type=Float32, ColorInterp=Undefined Min=1482.415 Max=3253.000 NoData Value=-3.40282e+38 Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 15 GDAL - gdalinfo - Dataset related commands (cont.) In summary, the following information has been provided for our dataset: • The data format : specified by the driver information • The pixel dimensions of the raster • The coordinate system of the raster, specified in OGC WKT (well-known text) • The coordinates of the origin (upper-left corner) of the raster • The pixel resolution of the raster, in the units of the raster coordinate system • The coordinates of the four corners and center point of the raster • Information (including value type, min/max values., and no- data value) about the band containing the elevation values Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 16 GDAL - gdal_translate gdal_translate provides (in addition to the general functions previously described) the capability to convert raster datasets from one format to another. • The syntax for the gdal_translate utility may be obtained by typing the command without any parameters. > gdal_translate Usage: gdal_translate [--help-general] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/ Float64/CInt16/CInt32/CFloat32/CFloat64}] [- not_strict] [-of format] [-b band] [-outsize xsize[%] ysize[%]] [-scale [src_min src_max [dst_min dst_max]]] ulx uly lrx lry] [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-gcp pixel line easting northing]* [-mo "META-TAG=VALUE"] * [-quiet] [-sds] [-co "NAME=VALUE"]* src_dataset dst_dataset <continued> Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 17 GDAL - gdal_translate > gdal_translate <continuation> GDAL 1.2.6.0, released 2005/03/13 The following format drivers are configured and support output: VRT: Virtual Raster GTiff: GeoTIFF ... JPEG2000: JPEG-2000 part 1 (ISO/IEC 15444-1) FIT: FIT Image USGSDEM:

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    51 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us