[gdal-dev] problem rasterizing categorical data from shapefile - 0 values at some intersections

Etienne etiennesky at yahoo.com
Thu Aug 4 22:10:21 EDT 2011


Hi all,

I am trying to create a raster file with categorical data (land vegetation/cover positive indices) from a shapefile containing 1 layer of polygons.  

I use the following command: 
gdal_rasterize  -tr 0.0005 0.0005  -a_nodata -1 -of GTiff  -a_srs EPSG:4618 -a "CLASSE_ID" -ot Byte -init -1 -l region1 region1.shp region1-3.tif

This creates a  map which looks good, but there are some holes in the data, (individual pixels with a value of 0) at the intersection of 2 polygons. It looks like the
intersections pass through the exact center of these pixels. These pixels are not set to missing(-1). Depending on the output resolution, different pixels get set to a value of 0.

Has anyone ran into this problem?  Any idea how to fix this?  
Those interested will find 2 small shapefiles here: http://db.tt/3X4hI45 and http://db.tt/phqnGci


I tried using gdal_grid, but it doesn't seem to support a shapefile with POLYGONs.

many thanks!
Etienne



More information about the gdal-dev mailing list