Geography Reference
In-Depth Information
For additional information on using GMT with GRASS, see “Producing
Press-Ready Maps with GRASS and GMT” by Dylan Beaudette in OSGeo
Journal, Volume 1, May 2007.
1
11.2
Using GDAL and OGR
We have seen examples of the GDAL and OGR utilities previously in
several sections. Now we will take a more focused look at the utilities
and how they are used. You will quickly see that this set of tools belongs
in your toolkit, especially if you plan to do any data manipulation.
If you want a quick overview of the formats supported by GDAL and
OGR, on page
283
in our survey of OSGIS software.
Getting Information
One of the key uses of the GDAL/OGR utilities is getting information
about a supported raster or vector file. The commands used are
gdal-
info
and
ogrinfo
, respectively. Let's take a better look at each of these
utilities.
Vector Information
You download a shapefile from the Internet and unzip it. Now you have
a batch of files sitting there (remember, a shapefile consists of at least
three files). What attributes does the shapefile contain? What kind of
features does it store—points, lines, or polygons? What projection or
coordinate system does it use? We are in luck;
ogrinfo
can answer all
those questions for us.
The
ogrinfo
utility can provide information on both a single layer and all
layers in a directory. For example, for a summary of all shapefiles in a
directory, we just have to provide the directory name:
$
ogrinfo ./desktop_gis_data
INFO: Open of `./desktop_gis_data'
using driver `ESRI Shapefile' successful.
1: cities (Point)
2: AKvolc_v3 (Point)
3: world_borders (Polygon)
From the output we can see that the directory
desktop_gis_data
contains
three shapefiles:
cities
,
AKvolc_v3
, and
world_borders
. The results for each
1.
Search WWH ::
Custom Search