Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How does the rasterize tool decide which value to represent when a cell covers an area which inclueds different values? I need it in this case for polygons but would like to know for lines and points as well. What are the rules that it follows.

share|improve this question

1 Answer 1

Looking at the source here and here, it seems GDAL just starts from the top of the list and works its way down, so it'll be in whatever order the shapes are stored in, overwriting any data that was stored in a given pixel. I'm not even sure it does anything with attribute indexes.

Addendum

The rasterizer by default just uses the centre of the pixel for polygons, or Bresenham's algorithm for lines (presumably points are just nearest neighbour). There appears to be an option to fill any touched pixel that can, I think, be supplied on the command line. There's a comment to this effect in the code:

462  * <dt>"ALL_TOUCHED":</dt> <dd>May be set to TRUE to set all pixels touched
463  * by the line or polygons, not just those whose center is within the polygon
464  * or that are selected by brezenhams line algorithm.  Defaults to FALSE.</dd>

So there is no blending at all, and it doesn't try to do anything clever.

share|improve this answer
    
Thanks for the reply. Should prove useful later on. What I would like to know is how the rasterize function selects the representative value from the shape. Does it use the centrepoint value or the highest percentage coverage and how does it deal with a 50/50 situation etc? The source is still a bit tricky for me to understand sorry. –  Andre Wise Apr 11 '12 at 20:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.