1

I want to create an new empty shapefile with OSGeo4W shell.

Is there a command line like:

gdal_create -f "ESRI Shapefile" -wkt "point" -srs "EPSG:31256" -o output.shp
1

There is no such create option in GDAL tools but a proper solution would require writing a few lines of Python code. Best workaround that comes into my mind is to select data from any existing data source with point geometries by using SQL that finds nothing.

ogr2ogr -of "ESRI Shapefile" -sql "select geometry from test where 1=2" emptytest.shp test.shp

ogrinfo emptytest.shp -al
INFO: Open of `emptytest.shp'
      using driver `ESRI Shapefile' successful.

Layer name: emptytest
Metadata:
  DBF_DATE_LAST_UPDATE=2020-01-21
Geometry: Point
Feature Count: 0
Extent: (0.000000, 0.000000) - (0.000000, 0.000000)
Layer SRS WKT:
PROJCRS["MGI / Austria GK East",
    BASEGEOGCRS["MGI",
        DATUM["Militar-Geographische Institut",
            ELLIPSOID["Bessel 1841",6377397.155,299.1528128,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4312]],
    CONVERSION["Austria Gauss-Kruger East",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",16.3333333333333,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",1,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",-5000000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["northing (X)",north,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["easting (Y)",east,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["unknown"],
        AREA["Austria - east of 14┬░50'E"],
        BBOX[46.56,14.83,49.02,17.17]],
    ID["EPSG",31256]]
Data axis to CRS axis mapping: 2,1

An empty shapefile of the same type as the source data (point), with CRS EPSG:31256, and with no features nor attributes was created.

Your Answer

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

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