[Gdal-dev] Question about gdal_rasterize

Guillaume HUBY ghuby at geosys.com
Wed Apr 12 11:56:02 EDT 2006


Frank,

I had a look on apps\gdal_rasterize.cpp and GDALRasterizeGeometries(...) in
alg\gdalrasterize.cpp and it seems quite tricky and taking too much time
investment to get down lower levels and get what I want.

The alternative you proposed should be OK for my purposes, but it is not an
exact solution : think of a thin part of polygon getting inside and outside
a pixel through the same side (yes, that's a tricky case) ...

An exact method should compute if a polygon edge cut a pixel edge and if
pixel is inside polygon.

Thanks,
Guillaume.

-----Message d'origine-----
De : Frank Warmerdam [mailto:fwarmerdam at gmail.com] De la part de Frank
Warmerdam
Envoyé : mercredi 12 avril 2006 17:31
À : Guillaume HUBY
Cc : gdal-dev at lists.maptools.org
Objet : Re: [Gdal-dev] Question about gdal_rasterize


Guillaume HUBY wrote:
> Hello,
> 
> I have a question about gdal_rasterize. I'm using
> 
>>> gdal_rasterize --version
> GDAL 1.3.1.0, FWTools 1.0.0b2, released 2006/03/30
> 
> I achieved to rasterized an ESRI polygon shapefile on some Geotiff 
> raster. The pixels was burned when their center was inside the 
> polygon. I would like to know if there is a way to burn pixels which 
> are entirely inside polygons. I mean that the four corners of pixels 
> are inside without intersecting polygon.
> 
> I would be very grateful if someone could answer this question.

Guillaume,

There is no support for this in the GDAL rasterizer.  You could try and
fiddle with the low level to allow this but it could be pretty tricky.

Another alternative would be to rasterize four rasters all offset by half a
pixel in the four directions, and then merge them - only setting the target
pixel if all our offsets were rasterized.

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 OSGF, http://osgeo.org






More information about the Gdal-dev mailing list