0

How can i get only attributes names from GeoJSON?

ogrinfo gets attributes with others info:

ogrinfo -al -so rw.geojson

Output is:

    ERROR 4: GeoJSON Driver doesn't support update.
Had to open data source read-only.
INFO: Open of `rw.geojson'
      using driver `GeoJSON' successful.

Layer name: OGRGeoJSON
Geometry: Line String
Feature Count: 31888
Extent: (12.224042, 48.586482) - (18.789360, 51.043735)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AUTHORITY["EPSG","4326"]]
FID Column = id
id: Integer (0.0)
railway: String (0.0)
railway_tr: String (0.0)
usage: String (0.0)
i d: Integer (0.0)
  • Ogrinfo in not made for such use but you can do it with Python as in here (duplicate?) gis.stackexchange.com/questions/220844/… – user30184 7 mins ago – user30184 Sep 11 '18 at 8:16
  • To suppress such error just add -ro option (readonly). It's very strange, as GeoJSON Driver support update since GDAL 2.1 - gdal.org/drv_geojson.html – Dmitry Baryshnikov Sep 11 '18 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.