Geography Reference
In-Depth Information
shapefile includes its type. This is good summary information, but what
if we want more detail? By specifying the layer name, ogrinfo will give
us very detailed information about the layer:
$ ogrinfo -so -al ./desktop_gis_data cities
INFO: Open of `./desktop_gis_data'
using driver `ESRI Shapefile' successful.
Layer name: cities
Geometry: Point
Feature Count: 606
Extent: (-165.270004, -53.150002) - (177.130188, 78.199997)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.0174532925199433]]
NAME: String (40.0)
COUNTRY: String (12.0)
POPULATION: Real (11.0)
CAPITAL: String (1.0)
The result gives us a detailed summary of information about the cities
layer. We can see it is a point layer with 606 features. The coordinate
system is WGS84, meaning the coordinates are in latitude and longi-
tude. We also get a summary of the fields and their types, along with the
extent of the layer. Armed with this information, we can easily deter-
mine whether a layer is suitable for our use and is in an appropriate
coordinate system.
Notice the -so switch in the previous example. We used it in combination
with the -al switch in order to get detailed information about the layer.
The -so switch tells ogrinfo to print a summary only; otherwise, it would
also print each record in the shapefile, complete with all the attributes
as well as the coordinate information. There are times you may want
to view all the information, perhaps dumping it to a text file for further
use.
We can use the OGR utilities with more than just shapefiles. To get
a quick list of the supported drivers for your installation of OGR, use
the --formats switch. The formats you find available will depend on how
your version of OGR was compiled. If our version contains support for
PostgreSQL, we can get information on layers stored in our PostGIS-
enabled database.
 
 
Search WWH ::




Custom Search