[GRASS-SVN] r55923 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 20 02:30:42 PDT 2013


Author: zarch
Date: 2013-04-20 02:30:42 -0700 (Sat, 20 Apr 2013)
New Revision: 55923

Modified:
   grass/trunk/lib/python/pygrass/vector/geometry.py
Log:
Fix WKT export for Point class and return more than one value from the Attrs class

Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py	2013-04-19 22:32:53 UTC (rev 55922)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py	2013-04-20 09:30:42 UTC (rev 55923)
@@ -163,7 +163,7 @@
                                                          tname=self.table.name,
                                                          condition=self.cond))
         results = cur.fetchone()
-        return results[0]
+        return results[0] if len(results) == 1 else results
 
     def __setitem__(self, key, value):
         """Set value of a given column of a table attribute. ::
@@ -395,15 +395,15 @@
 
             >>> pnt = Point(10, 100)
             >>> pnt.get_wkt()
-            'POINT(10.000000, 100.000000)'
+            'POINT(10.000000 100.000000)'
 
         .. warning::
 
             Only ``POINT`` (2/3D) are supported, ``POINTM`` and ``POINT`` with:
             ``XYZM`` are not supported yet.
         """
-        return "POINT(%s)" % ', '.join(['%f' % coord
-                                        for coord in self.coords()])
+        return "POINT(%s)" % ' '.join(['%f' % coord
+                                      for coord in self.coords()])
 
     def get_wkb(self):
         """Return a "well know binary" (WKB) geometry buffer



More information about the grass-commit mailing list