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

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)


This link has many examples of ogr sql:


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.