[gdal-dev] question about using gdal_rasterize
Frank Warmerdam
warmerdam at pobox.com
Wed Feb 13 11:37:31 EST 2008
Limei Ran wrote:
> Hi:
>
> I need to rasterize a polygon shapefile with a modified map extent. I
> did not see setting x and y min and max for the shapefile when using
> gdal_rasterize. I can use gdal_rasterize first and then gdalwarp to set
> the extent . Are there any direct way to do it with some codings?
Limei,
I do not believe that gdal_rasterize currently supports creating the raster
file - it expects to be provided with one with the desired extents already
set. I sometimes use gdal_translate to create a suitable file.
For instance:
gdal_translate utm.tif -a_srs WGS84 -a_ullr -180 90 180 -90 \
-scale 0 255 0 0 -outsize 1800 900 world.tif
This "in theory" translates the input file to the output file, but
in fact, it changes all characteristics (region, coordinate system)
and even flattens all the pixels to zero with -scale.
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 | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list