14

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 3

30
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.

2

Please check out https://github.com/GeospatialPython/pyshp an easy way to get information about shapefile.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.