Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing Attribute values of Shape file ogrinfo/ogr2ogr

Tags:

shapefile

ogr

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)
like image 333
Dawid Avatar asked Oct 16 '25 15:10

Dawid


1 Answers

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.

like image 200
kaycee Avatar answered Oct 19 '25 13:10

kaycee