[GRASS-dev] How to check if a vector map is multi-layer?

Markus Metz markus.metz.giswork at gmail.com
Sat Nov 1 15:34:19 PDT 2014


On Fri, Oct 31, 2014 at 9:34 AM, Markus Metz
<markus.metz.giswork at gmail.com> wrote:
> On Thu, Oct 30, 2014 at 3:23 PM, Luca Delucchi <lucadeluge at gmail.com> wrote:
>> On 30 October 2014 15:08, Markus Metz <markus.metz.giswork at gmail.com> wrote:
>>> On Thu, Oct 30, 2014 at 2:31 PM, Luca Delucchi <lucadeluge at gmail.com> wrote:
>>>> Hi Markus,
>>>>
>>>> On 29 October 2014 09:15, Markus Metz <markus.metz.giswork at gmail.com> wrote:
>>>>
>>>>>
>>>>> Please try the attached patch for gui/wxpython/rlisetup.
>>>>>
>>>>
>>>> I test your patch and it works. I improved a little bit it (attached
>>>> the new patch).
>>>
>>> Why did you remove the part that removes duplicates? This is needed in
>>> order to avoid that the same raster is created twice, independent of
>>> whether a feature has multiple categories or not (different features
>>> can have the same category).
>>>
>>
>> I only move it to a function because it is used more than one, and
>> change the for loop with a single line code [ sorted(set(list))  this
>> is what I usually use in Python to remove duplicate from list ]
>
> Oops, I did not notice the set(), sorry!
>
>>
>>> The description of the new function obtainCategories() is wrong. The
>>> function does not check whether a vector is multilayer. The function
>>> does not even check whether a feature has multiple categories in a
>>> given layer. The function returns a list of all categories in layer X
>>> for type=centroid which is what you want for g.gui.rlisetup.
>>
>> ok, could you fix the description with the right sentence?
>
> See attached patch.
>>
>>> Actually,
>>> g.gui.lisetup does not care about the vector layer, which is another
>>> bug. And it does not care about the vector type. You should add the
>>> options layer= and type= wherever appropriate.
>>>
>>
>> You are right, for the type we could add a check when the user select
>> the vector, only vector with areas should be accepted.
>
> I have added type= where it was missing.
>>
>> For the layer I don't know what could be the right solution, maybe
>> another combobox to select the layer to use?
>
> Yes, or fix it to layer 1. I have added a layer option to the relevant
> functions in functions.py, right now fixed to 1.
>
> You can submit the attached patch if it works for you.

My previous patch did not work for me, but the attached patch
gguirlisetup.patch3 works for me now. Please test.

Markus M
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gguirlisetup.patch3
Type: application/octet-stream
Size: 7765 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141101/4035cb3c/attachment.obj>


More information about the grass-dev mailing list