I'm following Mike Bostock's tutorial "Let's Make A Map." He explains how to filter a shapefile using ogr2ogr
based on the attributes of the features. I can open a shapefile in QGIS and look at the attribute table to find out what those features are. Is there a way to find that information from the command line?
3 Answers
ogrinfo -so -al yourshapefile.shp
This will give you geometry type, number of features/shapes, bounding box corners, projection information, and the name of each attribute file as well as the datatype stored in those attributes.
Please check out https://github.com/GeospatialPython/pyshp an easy way to get information about shapefile.
Have you tried this method:
-where restricted_where:
Attribute query (like SQL WHERE)
http://www.gdal.org/ogr2ogr.html
This link has many examples of ogr sql:
http://www.compsci.wm.edu/SciClone/documentation/software/geo/gdal-1.9.0/html/ogr/ogr_sql.html