[Gdal-dev] how gdal_rasterize works

Markus Neteler neteler at itc.it
Sat Jun 17 08:28:17 EDT 2006


On Fri, Jun 16, 2006 at 04:04:43PM -0400, Frank Warmerdam wrote:
> Luke Roth wrote:
> >I've been trying to use the polygon rasterization functions in 
> >alg/gdalrasterize.cpp for a while now, but I just can't get it to do 
> >what I want.  I've been using apps/gdal_rasterize.exe to rasterize an 
> >entire vector layer, but what I'd really like to do is to rasterize 
> >individual polygons from my C code without having to run 
> >gdal_rasterize.exe for each individual feature.  I've tried using the 
> >apps/gdal_rasterize.cpp code as a template, but I'm not getting 
> >anywhere.  Can anyone who has used this code give me a simple 
> >walkthrough or nudge me in the right direction?  I can give more details 
> >if it would help.
> 
> Luke,
> 
> You should be able to follow the gdal_rasterize.c code as a template
> for this.  If you are running into problems, you might need to be specific
> about what is going wrong.
> 
> Are you calling GDALRasterizeGeometries() once for each feature?  Keep in
> mind that the downside of doing this is that a complete pass through the
> raster (read/write) must be made for each features.  Well, actually come
> to think of it, the code might be smart enough to focus on the area of
> the geometry, but still it is likely to result in quite a bit of extra
> read/write work on the raster.
> 
> As Chris Barker suggests, GDAL's rasterization capability is not
> sophisticated from a render styling point of view.  Other tools may
> be more appropriate if you want to do anything more sophisitcated
> that rasterize the polygons in a single solid color.
> 
> For more interactive help, you might want to drop into #gdal on
> irc.freenode.net.  I should be around for a while.
> 

Hi,

a stupid command line question: If a SHAPE is my starting point, how
to generate the needed raster map for "burn in" (if I don't
want to launch my GRASS machine for this)?

Certainly easy, but I don't recall...

thanks

 Markus



More information about the Gdal-dev mailing list