[GRASS-user] Determining maximum value of attributes where areas are overlapping in imported vector layer

Rainer M Krug r.m.krug at gmail.com
Tue Jul 8 09:33:00 EDT 2008


On Tue, Jul 8, 2008 at 3:19 PM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 08/07/08 15:02, Rainer M Krug wrote:
>>
>> On Tue, Jul 8, 2008 at 10:25 AM, Rainer M Krug <r.m.krug at gmail.com> wrote:
>>>
>>> On Mon, Jul 7, 2008 at 9:37 PM, Markus Neteler <neteler at osgeo.org> wrote:
>>>>
>>>> On Mon, Jul 7, 2008 at 6:28 PM, Rainer M Krug <r.m.krug at gmail.com>
>>>> wrote:
>>>>>
>>>>> On Mon, Jul 7, 2008 at 6:19 PM, Markus Neteler <neteler at osgeo.org>
>>>>> wrote:
>>>>>>
>>>>>> On Mon, Jul 7, 2008 at 6:11 PM, Rainer M Krug <r.m.krug at gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I am back with a problem of imported shape files:
>>>>>>>
>>>>>>> I have imported a shape file and it contains several areas where
>>>>>>> polygons are overlapping. After I managed to obtain the number of
>>>>>>> overlapping polygons and exported it to a raster layer
>>>>>>> (http://grass.osgeo.org/wiki/Vector_Overlapping_Areas), I would now
>>>>>>> need the maximum value of an attribute column for this areas.
>>>>>>>
>>>>>>> Any ideas how I can achieve this?
>>>>>>
>>>>>> You can use 'db.select':
>>>>>>
>>>>>> echo "SELECT max(N1) FROM lidar2" | db.select
>>>>>> max(N1)
>>>>>> 512834.76000000000931
>>>>>
>>>>> Sorry for not being spoecific enough - I want the maximum values as
>>>>> ributes in an attribute table.
>>>>> As far as I can see, this just gives me the maximum value of the whole
>>>>> table - but I need it spatially, i.e. for each area which is
>>>>> overlapping, the maximum value.
>>>>
>>>> Then v.to.db might be helpful.
>>>> http://grass.osgeo.org/grass64/manuals/html64_user/v.to.db.html
>>>>
>>>> -> see qcolumn parameter.
>>>
>>> Thanks - tha is working now.
>>
>> I was to fast - it is not working.
>>
>> The reason is the following: if a small polygon A with YEAR=2006 is
>> completely overlapping with a larger polygon B with YEAR=2000,
>> max(YEAR) returns 2006 for the whole of polygon B - which is not what
>> I want. I would like to have 2006 for polygon A and 200 for polygon B,
>> except of the are where it overlaps with polygon A.
>>
>> Any ideas on how to achieve this?
>
> v.overlay + v.to.db ?

I thought the same, but when I do v.overlay, it only takes one value
per polygon over to the new layer. If I could specify the max(YEAR)
query to choose the value, that would be the solution. Just look at
http://grass.osgeo.org/wiki/Vector_Overlapping_Areas - I used the
second solution for the count of the layers per location - but I don;t
have an ide to do it for max(YEAR)


>
> Moritz
>
>
>>
>> Thanks
>>
>> Rainer
>>
>>
>>> Rainer
>>>
>>>> Markus
>>>>
>>>
>>>
>>> --
>>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>>> Biology, UCT), Dipl. Phys. (Germany)
>>>
>>> Plant Conservation Unit
>>> Department of Botany
>>> University of Cape Town
>>> Rondebosch 7701
>>> South Africa
>>>
>>
>>
>>
>
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Plant Conservation Unit
Department of Botany
University of Cape Town
Rondebosch 7701
South Africa


More information about the grass-user mailing list