[gdal-dev] Understanding gdal_rasterize
Hermann Peifer
peifer at gmx.eu
Mon Oct 21 09:27:50 PDT 2013
On 2013-10-21 14:46, Paul Meems wrote:
> I'm trying to understand how gdal_rasterize works.
> As a test I'm trying to convert a shapefile with all counties of the USA
> to a GeoTiff.
> I've added a field to the shapefile called myID which is equal to the
> shape number.
> The goal is to create a tiff with each county its own value.
>
> This is my command:
> gdal_rasterize -a myID -l counties -of GTiff -a_nodata -999 -ts 800 800
> counties.shp GDALRasterizeTest.tif
>
You could drop "-of GTiff" as GTiff is anyway the default format.
"-a_nodata -999" makes most sense in combination with "-init -999".
Anything else looks fine to me.
> I'm having trouble understanding the -ts or -tr parameters.
> Using the above command I get an 800*800 tiff which shows the USA, but
> it looks like all pixels are the same color.
-ts obviously sets the output file size, to 800x800 pixels, as you noted
yourself. Do all pixels also have the same *value* ?
Hermann
More information about the gdal-dev
mailing list