[GRASS-user] Pygrass vector package: write geometric feature in a specific layer
Pietro
peter.zamb at gmail.com
Wed Dec 10 01:12:43 PST 2014
Hi Laurent,
sorry for the late reply.
On Wed, Dec 3, 2014 at 10:14 PM, Laurent C. <lrntct at gmail.com> wrote:
> 2014-12-03 0:28 GMT-06:00 Pietro <peter.zamb at gmail.com>:
>
>> # you have to set the category for the second layer
>> cats = Cats(pump.c_cats)
>> cats.reset()
>> cats.set(vct.nlines + 1, lpumps.layer)
>> # finally write the pump
>> vct.write(pump, attrs=pumpattr, set_cats=False)
>>
>
> Hi Pietro,
>
> Thanks for your answer, and for your work on pygrass.
> It's the use of Cats that I was missing. However when I tried that :
> {{{
> cats = Cats(new_conduit.c_cats)
> cats.reset()
> cats.set(new_vect_map.nlines + 1, lconduit.layer)
> new_vect_map.write(new_conduit, attrs=dbline_content, set_cats=False)
> }}}
>
> I got the following error :
> "cats.set(new_vect_map.nlines + 1, lconduit.layer)
> AttributeError: 'VectorTopo' object has no attribute 'nlines' "
the attribute name was 'n_lines' sorry for the misspelling! and it is
the counter used when writing the geometry feature, basically it does
exactly the thing that you have done manually with the new counter.
However I should change the behavior of the write method to make it
more flexible.
If you have any cleaner ideas on how you would like to interact and
write geometry features may be we can implement it.
Best regards
Pietro
More information about the grass-user
mailing list