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

Luca Delucchi lucadeluge at gmail.com
Thu Oct 30 07:23:42 PDT 2014

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 ]

> 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?

> 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.

For the layer I don't know what could be the right solution, maybe
another combobox to select the layer to use?

> Markus M



More information about the grass-dev mailing list