[GRASS-SVN] r66911 - grass/trunk/lib/python/pygrass/vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 24 05:40:04 PST 2015
Author: martinl
Date: 2015-11-24 05:40:04 -0800 (Tue, 24 Nov 2015)
New Revision: 66911
Modified:
grass/trunk/lib/python/pygrass/vector/__init__.py
Log:
pygrass: fix writing categories for features
Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py 2015-11-24 08:46:22 UTC (rev 66910)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py 2015-11-24 13:40:04 UTC (rev 66911)
@@ -177,15 +177,18 @@
"""
self.n_lines += 1
- if self.table is not None and attrs and cat is not None:
- if cat not in self._cats:
- self._cats.append(cat)
+ if attrs and cat is None:
+ cat = (self._cats[-1] if self._cats else 0) + 1
+
+ if cat is not None and cat not in self._cats:
+ self._cats.append(cat)
+ if self.table is not None and attrs is not None:
attr = [cat, ]
attr.extend(attrs)
cur = self.table.conn.cursor()
cur.execute(self.table.columns.insert_str, attr)
cur.close()
-
+
if cat is not None:
cats = Cats(geo_obj.c_cats)
cats.reset()
More information about the grass-commit
mailing list