Geoscience Reference
In-Depth Information
ogrinfo -so -al google_vector.sqlite
INFO: Open of 'google_vector.sqlite'
using driver 'SQLite' successful.
Layer name: temporary places
Geometry: 3D Polygon
Feature Count: 5
Extent: (-95.362739, 29.710057) - (-95.329146, 29.723044)
Layer SRS WKT:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4326"]]
FID Column = OGC_FID
Geometry Column = GEOMETRY
name: String (0.0)
description: String (0.0)
For completeness, we will show how you can use OGR to return the coordinates
of the forest polygon mentioned above as a text file. The
grep
command that is
piped to OGR extracts the line(s) that contain the wildcard 'POLYGON', otherwise
additional information would have been printed.
ogrinfo -dialect SQLite -sql "select AsText(GEOMETRY) from
→
temporaryplaces where name = 'forest2'"
→
google_vector.sqlite
| grep POLYGON
In the following code snippet we will add a new attribute (area) and then calculate
the area for each of the polygon features using the Spatialite functions and then use
ogrinfo
to return the areas of the individual features.
ogrinfo -dialect SQLite -sql "ALTER TABLE temporaryplaces ADD
→
COLUMN area FLOAT" google_vector.sqlite
ogrinfo -dialect SQLite -sql "UPDATE temporaryplaces SET area =
→
ST_Area(geometry)" google_vector.sqlite
Search WWH ::
Custom Search