Geoscience Reference
In-Depth Information
ogrinfo -dialect SQLite -sql "select ST_Area(GEOMETRY) from
temporaryplaces" google_vector.sqlite
INFO: Open of 'google_vector.sqlite'
using driver 'SQLite' successful.
Layer name: SELECT
Geometry: None
Feature Count: 5
Layer SRS WKT:
(unknown)
ST_Area(GEOMETRY): Real (0.0)
OGRFeature(SELECT):0
ST_Area(GEOMETRY) (Real) = 2.68268534020212e-07
OGRFeature(SELECT):1
ST_Area(GEOMETRY) (Real) = 3.57788497123427e-07
OGRFeature(SELECT):2
ST_Area(GEOMETRY) (Real) = 1.69173290696687e-07
OGRFeature(SELECT):3
ST_Area(GEOMETRY) (Real) = 4.50152450024885e-06
OGRFeature(SELECT):4
ST_Area(GEOMETRY) (Real) = 1.94622220476419e-06
One of the final steps in this case study is to add a field that will hold a numeric
class label for each of the landuse types in the database. This could have been done
during the editing process in Google Earth, but we consider that it is a useful exercise
to demonstrate how it can be done using ogrinfo . We will add a field called Label
and then create a short Bash script to update the values in the layer based on the land
use type field, name based on the values in Table 16.1 .
For those of you familiar with shell programming, the next snippet should be
straightforward. To begin with, you should open a text editor (e.g. vi, gedit or emacs)
and enter the following lines. The first line defines, which shell should be used for
the script. We then issue an ogrinfo command that adds an integer column 'Label'
to the database table: 'temporaryplaces'. We have created an array (landuse_array)
that holds all of the landuse types defined in Table 16.1 . We set a counter, i equal
to 1 and the for loop iterates through the array and each time increments the code
label. The ogrinfo command executes an SQL UPDATE statement by updating
all features that have the particular landuse array.
 
 
Search WWH ::




Custom Search