[GRASS-dev] [GRASS GIS] #2320: PyGRASS doesn't write 3D vector map
GRASS GIS
trac at osgeo.org
Mon Jun 2 14:03:53 PDT 2014
#2320: PyGRASS doesn't write 3D vector map
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Keywords: pygrass | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
When I create a new vector using PyGRASS, create 3D points and write them
to the map, v.info says the map is 2D. The problem is that PyGRASS doesn't
specify anywhere that the map should be 3D. The following change works for
me but I am not completely sure it's correct:
{{{
Index: pygrass/vector/__init__.py
===================================================================
--- pygrass/vector/__init__.py (revision 60631)
+++ pygrass/vector/__init__.py (working copy)
@@ -187,6 +187,12 @@
if geo_obj.gtype == _Area.gtype:
result = self._write_area(geo_obj)
+
+ if not geo_obj.is2D:
+ self.c_mapinfo.contents.head.with_z = 1
+ self.c_mapinfo.contents.plus.with_z = 1
+ self.c_mapinfo.contents.plus.spidx_with_z = 1
+
result = libvect.Vect_write_line(self.c_mapinfo, geo_obj.gtype,
geo_obj.c_points,
geo_obj.c_cats)
if result == -1:
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2320>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list