[GRASS-user] buffer vector within a given area
Moritz Lennert
mlennert at club.worldonline.be
Sat Apr 25 04:29:20 EDT 2009
On 24/04/09 16:40, Martin Schweizer wrote:
> Annalisa
> Thanks for your help, but there is a little problem: I calculate the
> agricultural land around a city, then i buffer the vector, transform it
> into a raster map and subtract all the "not possible land". At the end,
> there is less agricultural land than I calculated. There must be a
> buffering operation which excludes already the NULL values of the "agri
> map" in the calculation.... is there something like that?
No.
I think you will have to script with some looping. You could start with
v.buffer and than for those areas where cutting out the not-possible
land leaves less than the necessary area, loop through e.g. r.grow and
cutting off the non-available land, then check the size and continue
growing+cutting until you reach that size.
Or you could probably cook something up in r.mapcalc.
Moritz
>
> Thanks a lot
>
> Martin
>
> Annalisa Minelli schrieb:
>> Martin,
>> after you have done the buffering operation (as Moritz said), and
>> transformed vector map (buffer_areas) in raster (v.to <http://v.to>
>> rast), you can easily extract only the interested areas by using a
>> mapalgebra operation.. for example:
>>
>> if "agri" is the map of your agricultural areas (green map)
>> and "buff" is the map of the buffer around the vector points
>>
>> you can type:
>>
>> r.mapcalc "interested_areas = agri * buff"
>>
>> all cells with a not-zero value are the interested areas..
>> (I usually prefer to use NULL rather than ZERO.. if you prefer it too,
>> you can use r.null to transform ZERO to NULL values)
>>
>> Hope this helps!
>>
>> Annalisa
>>
>>
>>
>> 2009/4/23 Martin Schweizer <schweizermartin at students.unibe.ch
>> <mailto:schweizermartin at students.unibe.ch>>
>>
>> Hi Moritz
>>
>> Thanks for your help. The problem is, that not each pixel around a
>> point
>> (city) can be used as agricultural land. So I can't simply buffer the
>> cities with a circle. To concretize what i mean, i made a picture:
>> http://www.fotos-hochladen.net/view/landandcity1hjbk4qy3.jpg in green
>> you see the potential agricultural land and the black point is a
>> city....
>>
>> Thanks a lot
>>
>> Martin
>>
>> Moritz Lennert schrieb:
>> > On 22/04/09 20:39, Martin Schweizer wrote:
>> >> Hi
>> >>
>> >> I have a question which is a bit complex. Hope i can describe
>> it ;-).
>> >>
>> >> I have a point-vector layer (the citis) and a raster layer with
>> 1 and
>> >> ZERO cells (The potenial agricultural land). One categorie in
>> the vector
>> >> layer is the land (Squaremeter) that hast to be cultivated for each
>> >> point (city). The question is now: How can I calculate and display,
>> >> which cells of the raster map (potential agricultural land)
>> hast to be
>> >> cultivated? Must be some sort of buffer or neighbourhood.....?
>> >
>> > Assuming that this agricultural land is the same in all
>> directions of
>> > the city, create a column which contains the radius of the
>> circle that
>> > encompasses the land needed (i.e. if my memories of geometry are
>> > correct: sqrt(surface/pi) and feed the name of this column to the
>> > bufcol= parameter of v.buffer (or feed the formula directly to the
>> > bufcol parameter, but this only works if you use a db-backend which
>> > has a sqrt function, i.e. PostgreSQL).
>> >
>> > Moritz
>> >
>>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org <mailto:grass-user at lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>>
>
More information about the grass-user
mailing list