1

I am new at GIS.

I want to burn all polygons from a particular shapefile (i.e. Gbg13004.shp) into a RGB TIFF file (i.e. temp.tiff). I have tried the following command:

gdal_rasterize -burn 255 -burn 0 -burn 0 Gbg13004.shp temp.tif

This results in the following error:

ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.
ERROR 1: Cannot create temp.tif

Running ogrinfo on the input file results in the following output:

INFO: Open of `Gbg13004.shp'
  using driver `ESRI Shapefile' successful.

Layer name: Gbg13004
Metadata:
  DBF_DATE_LAST_UPDATE=2018-01-25
Geometry: Polygon
Feature Count: 15401
Extent: (177898.268767, 218649.356570) - (186487.066994, 226178.919467)
Layer SRS WKT:
PROJCS["Belge_Lambert_1972",
    GEOGCS["GCS_Belge_1972",
        DATUM["Reseau_National_Belge_1972",
            SPHEROID["International_1924",6378388.0,297.0]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["False_Easting",150000.01256],
    PARAMETER["False_Northing",5400088.4378],
    PARAMETER["Central_Meridian",4.367486666666666],
    PARAMETER["Standard_Parallel_1",49.8333339],
    PARAMETER["Standard_Parallel_2",51.16666723333333],
    PARAMETER["Latitude_Of_Origin",90.0],
    UNIT["Meter",1.0]]
OIDN: Integer64 (15.0)
UIDN: Integer64 (15.0)
VERSIE: Integer (4.0)
BEGINDATUM: Date (10.0)
VERSDATUM: Date (10.0)
TYPE: Integer (4.0)
LBLTYPE: String (64.0)
OPNDATUM: Date (10.0)
BGNINV: Integer (4.0)
LBLBGNINV: String (32.0)
LENGTE: Real (16.2)
OPPERVL: Real (16.2)

My problem seems similar to the one described in gdal_rasterize error: "attempt to create 0x0 dataset is illegal..". Here, the problem was solved by reprojecting the source file into a different coordinate system and rasterizing the projected shapefile. In my case, the source file is in EPSG:103300. After projecting it (using ogr2ogr) into WGS84 and rasterizing the result, I still got stuck on the same error.

How do I solve this?

  • 1
    What does ogrinfo show about you shapefile? Usage: ogrinfo -al -so Gbg13004.shp. – user30184 Feb 5 '18 at 13:29
  • I have added the output to the question. – jelleve Feb 5 '18 at 13:37
  • Try one of these projections epsg.io/?q=Belge+Lambert+1972 that start with EPSG instead of ESRI – Ian Turton Feb 5 '18 at 13:39
  • Could you please elaborate? I have tried e.g. ogr2ogr -s_srs EPSG:6190 -t_srs EPSG:6190 tmp.shp Gbg13004.shp (for each of the formats listed), followed by gdal_rasterize -burn 255 -burn 0 -burn 0 tmp.shp tmp.tif, but this still results in the same error. – jelleve Feb 5 '18 at 14:10
  • What if you define either the target resolution with -tr or target size with -ts? I am not sure if gdal_rasterize has any logic for computing a suitable resolution for a new image file if user does not define it. – user30184 Feb 5 '18 at 14:17

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.