Soory for the delay, On Fri, Jan 30, 2015 at 3:52 PM, Moritz Lennert <mlenn...@club.worldonline.be> wrote: > Is it possible in pygrass to append a new point to a map of points (same for > other features) ? Or do I have to get all the features of a map, and the new > feature, and then write all features to a new map ?
Yes, here an example, write a new map: {{{ >>> from grass.pygrass.vector.geometry import Point >>> from grass.pygrass.vector import VectorTopo >>> with VectorTopo('mypoits', mode='w') as my: ... my.write(Point(0, 10)) ... my.write(Point(5, 15)) ... }}} read an existing map: {{{ >>> with VectorTopo('mypoits', mode='r') as my: ... for p in my: ... print(p) ... POINT(0.000000 10.000000) POINT(5.000000 15.000000) }}} Add some new point to an existing map: {{{ >>> with VectorTopo('mypoits', mode='rw') as my: ... my.write(Point(10, 10)) ... my.write(Point(15, 15)) ... }}} and read again the modified map: {{{ >>> with VectorTopo('mypoits', mode='r') as my: ... for p in my: ... print(p) ... POINT(0.000000 10.000000) POINT(5.000000 15.000000) POINT(10.000000 10.000000) POINT(15.000000 15.000000) }}} All the best Pietro _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev