Geoscience Reference
In-Depth Information
Once we have created all of these functions, we are ready to run the script and
define some command line arguments. For instance, we can specify a random set of
100 sample points, defined by the bounding box 100, 100, 500, 500 and output as
a Spatialite database. The output can be plotted to illustrate the distribution of the
points within the bounding box (Fig. 14.7 ).
./dm_sample.py -f random -s 100 -b 100 100 500 500 -o SQLite
This section has provided an introduction to the GDAL Python bindings, which
demonstrates the OGRDataModel and specifically how vector data can be processed
and visualized. There are some important Python Gotchas or issues that you may
encounter when developing Python programs using GDAL/OGR that are unique
to these Python bindings and which have not been addressed above. For instance,
Python crashes if you new field is added to an OGR Layer, when the respective
features deriving from this layer are still active. In addition, if you use custom error
handlers within your programs the exceptions will not get caught. A more detailed
description of these unexpected problems are listed on the GDAL wiki. 11
Fig. 14.7 Random set of 100 sample points
11 http://trac.osgeo.org/gdal/wiki/PythonGotchas
 
 
Search WWH ::




Custom Search