I'm trying to use gdal_rasterize to convert a polygon shapefile into a raster, where the value comes from the 'COVTYPE' attribute. I try calling gdal rasterize like so (I'm calling from within a python script so I have to call os.system):
os.system("gdal_rasterize -a COVTYPE -l %s -a_nodata 999 -a_srs EPSG:102001 -t 30 30 %s %s" % (bname, inshp, outrast))
Where bname is the basename of the shapefile (aka the layer name), inshp is 'inpath/bname.shp' and outrast is 'outpath/bname.tif'.
And get the error : "ERROR 1: Attempt to create 0x0 dataset is illegal, sizes must be larger than zero. Cannot create outpath/bname.tif"
It was my understanding that with gdal>1.8 (I'm running gdal 1.9.2), gdal_rasterize could create a new raster file as long as -tr (target resolution) or -ts (target size) is set (see http://www.gdal.org/gdal_rasterize.html). I'm setting the target resolution, so I don't see why it thinks I'm trying to create a 0x0 raster. Additionally, documentation says that if the target extent isn't set, it'll take the extent of the vector layer, which is want I want.
I've tried calling gdal_rasterize outside of python and get the same error. I also tried rearranging some of the keywords and taking away the a_srs keyword thinking it may be causing problems (a_srs overrides the default projection for the output file), but still to no avail.
Does anyone have an inkling as to what's going on?