[GRASSLIST:5701] Re: Filling a polygon using a "bucket with color"

H Bowman hamish_nospam at yahoo.com
Sat Mar 1 00:35:47 EST 2003


> >     I have an area described by several lines and I need to find a
> >function which is similar to "spilling a color". From a given point I
> >need to set all surrounding points to have some speicifed
> >value/category until reaches wall(borders) from lines.
> >
> >     The border is defined by non-zero values, other values are zero
> >     (of course I can change it if needed). Any idea?


You can find an algorithm for "Determining Whether A Point Is Inside A
Complex Polygon" here: 
http://www.alienryderflex.com/polygon/

Aside from the explanation, that page includes a working C code snippet.


A custom module might be easier to implement rather than trying to get
that into r.mapcalc though.

If you are just defining the border from a set of points, make an ascii
poly file with r.in.poly; or vector file with v.in.ascii and then
manipulate with v.digit to set area centroids, and then v.to.rast ? 

maybe r.thin, r.line, v.digit, and then v.to.rast ?

best of luck.




More information about the grass-user mailing list