[gdal-dev] gdal_rasterize use SHP FID as burn attribute

Frank Warmerdam warmerdam at pobox.com
Mon Feb 8 19:56:45 EST 2010


Peter Rankor wrote:
> List,
> 
> I need to rasterize a polygon layer coming from a SHP file. However, the 
> values in the outputraster need to be the FID of the corresponding polygon.
> 
> My command:
> gdal_rasterize -a FID -l FECS FECS.shp flattenedRaster.tif

Peter,

Could you try:

gdal_rasterize -a FID \
     -sql "select FID, * from FECS" FEC.shp flattenedRaster.tif

The ExecuteSQL() method invoked for -sql should be able to treat FID
as a pseudo-attribute.  It's a bit unfortunate this sort of thing doesn't
work directly without the SQL route.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list