[GRASS-dev] Individual vector feature processing: v.clump?
Pietro
peter.zamb at gmail.com
Thu Dec 4 00:48:30 PST 2014
Hi Markus,
On Thu, Dec 4, 2014 at 8:34 AM, Markus Neteler <neteler at osgeo.org> wrote:
> On Wed, Dec 3, 2014 at 9:47 PM, Markus Metz
>> Adding unique categories to a new layer for the features in question
>> with v.category (take care of the type option) does not work in this
>> case?
>
> Likely it does (I am asking on behalf on another person not subscribed here).
> I wonder how to make it more obvious. And, if there is a best
> practice example written in Python/PyGRASS?
with pygrass at the moment the pseudo code is something like:
{{{
with VectorTopo('yourvectormap', mode='r') as vect:
for line in vect.viter('lines'):
# do something with line
pass
for area in vect.viter('areas'):
# do something with area
pass
}}}
but I'm thinking to change how to iter between vector features to make
the distinction between topological and not topological features
clearer, something like:
{{{
with VectorTopo('yourvectormap', mode='r') as vect:
for line in vect.features.lines:
# do something with line
pass
for area in vect.topo.areas: # nodes, centroid, etc.
# do something with area
pass
}}}
But I'm still thinking on it...
Best regards
Pietro
More information about the grass-dev
mailing list