4

How do I list the values of an attribute in a shape file.

ogrinfo -so -al build/SLA11aAust.shp shows the attributes. Which command to list values of STATE_CODE: :

Layer name: SLA11aAust
Geometry: Polygon
Feature Count: 1390
Extent: (96.816941, -43.740510) - (159.109219, -9.142176)
Layer SRS WKT:
GEOGCS["GCS_GDA_1994",
    DATUM["Geocentric_Datum_of_Australia_1994",
        SPHEROID["GRS_1980",6378137,298.257222101]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]
STATE_CODE: String (1.0)
SLA_CODE11: String (9.0)
SLA_NAME11: String (50.0)
SLA_5DIGIT: String (5.0)
SLA_REG11: String (9.0)
Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204
Dawid
  • 165
  • 4

1 Answers1

4

Based on this post, you could do something like that:

ogrinfo SLA11aAust.shp -dialect sqlite -sql "select STATE_CODE from SLA11aAust"

You could then refine the SQL query using SQLite statements to order the results or match a specific combination of arguments.

Community
  • 1
  • 1
kaycee
  • 901
  • 1
  • 9
  • 35