[GRASSLIST:4942] Re: distance

J.c.m. van der Kwast jkwast at home.nl
Wed Nov 13 07:20:04 EST 2002

Glynn Clements wrote:

>J.c.m. van der Kwast wrote:
>>Is it possible to fill a raster of an irregular shaped area with 
>>distance values perpendicular to a part of the edge of the same area, so 
>>that hat every cell has a distance value perpendicular and relative to a 
>>part of the edge?
>>I've been trying some things with mapcalc but without succes. So far 
>>according to me, the only way to do it would be to raster the line, and 
>>then buffer it with mask set to that polygon. Very tedious job if areas 
>>are big (maybe script?). Another approach was to draw parallel lines in 
>>a CAD program, depicting them as heightlines in Grass and then putting 
>>them thru v.surf.contours or s.surf.contours. This is not working to my 
>>satisfaction. I'll hope you'll have some insights, if it's possible at all.
>If you create a map where the inside of the polygon has value 1 while
>the outside has value 0, running r.cost with a start coordinate which
>is outside of the polygon will give approximately the right result.
Hi Glynn and others,

You're solution was not really what I was looking for. Though it gave me 
some insight about r.cost. I finally managed to come up with another 
solution. Attached to this mail are to images, fieldcost and field2. 
Fieldcost was made with r.cost and not quite what  I wanted. Field2 is 
the solution, though  it's flawed on one side. What I did was growing a 
border to a raster map of the area (area=cat1, everything else 0) and 
specifing the area where it should be, in my case the south border. Then 
with a scipt which repeatingly grew one cell border on top of the 
original border. Then mask the outcome with the original rastermap. So 
now almost every cell (except to the right, I've cut of the last part of 
the line going up in to steep an angle) has a value of distance (of 
course not completely true)  relative to the south border. I'm doing 
this in this manner to be able to grow paths along the border with a 
certain distance to this border, for instance tree lines or hiking paths.
Is it in view of the attached images possible to do this in another way, 
the path I've chosen is rather work intensive.  

greetings Sjors
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fieldcost.jpg
Type: image/jpeg
Size: 32916 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20021113/0b1924bf/fieldcost.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: field2.jpg
Type: image/jpeg
Size: 2673 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20021113/0b1924bf/field2.jpg

More information about the grass-user mailing list