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

G. Allegri giohappy at gmail.com
Wed Jul 9 06:30:11 EDT 2008


It's not clear to me your situation...
You have a singol vector layer with overlapping polygons? Did you
import it as Level 1 (non-topological)?

2008/7/9 Rainer M Krug <r.m.krug at gmail.com>:
> On Tue, Jul 8, 2008 at 6:34 PM, Moritz Lennert
> <mlennert at club.worldonline.be> wrote:
>> On 08/07/08 18:14, Rainer M Krug wrote:
>>>
>>> On Tue, Jul 8, 2008 at 4:21 PM, Moritz Lennert
>>> <mlennert at club.worldonline.be> wrote:
>>>>
>>>> On 08/07/08 15:33, Rainer M Krug wrote:
>>>>>
>>>>> 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)
>>>>
>>>> Not sure I understand. v.overlay operator=or should create new entities
>>>> which are (to use your example): a piece of polygon A where there is only
>>>> polygon A, a piece of polygon B where there is only polygon B and the
>>>> common
>>>> area between the two. In the table, you should then have the columns of
>>>> both
>>>> (a_cat, b_cat and a_YEAR, b_YEAR, etc) some of which will be null where
>>>> you
>>>> only have one of the two polygons. You can then query this table with
>>>> something like this:
>>>>
>>>> select a_YEAR ... where b_YEAR is null  or a_YEAR<b_YEAR
>>>
>>> Yes, that is right. It seems to be working for two overlapping
>>> polygons, but as soom as I have three overlapping polygons, I only get
>>> two YEARS back (a_YEAR and b_YEAR - as the overlay is done between two
>>> maps)
>>
>> Well, can't you then do a second overlay with the result of the first + the
>> third layer of polygons ?
>
> There seems to be still a misunderstanding, as all the polygons are in
> the same grass vector layer and if I overlay the first overlay again
> with the original layer, I the value of b_YEAR just becomes repeated.
>
> I will see that I construct a simple example and post it here.
>
> Thanks
>
> Rainer
>
>>
>> Moritz
>>
>
>
>
> --
> 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
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list