[GRASS-SVN] r56398 - grass/trunk/vector/v.out.postgis

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 24 05:05:12 PDT 2013


Author: martinl
Date: 2013-05-24 05:05:12 -0700 (Fri, 24 May 2013)
New Revision: 56398

Modified:
   grass/trunk/vector/v.out.postgis/args.c
   grass/trunk/vector/v.out.postgis/local_proto.h
   grass/trunk/vector/v.out.postgis/main.c
   grass/trunk/vector/v.out.postgis/v.out.postgis.html
Log:
v.out.postgis: added force2D flag (see v.out.ogr)


Modified: grass/trunk/vector/v.out.postgis/args.c
===================================================================
--- grass/trunk/vector/v.out.postgis/args.c	2013-05-24 11:45:07 UTC (rev 56397)
+++ grass/trunk/vector/v.out.postgis/args.c	2013-05-24 12:05:12 UTC (rev 56398)
@@ -68,5 +68,12 @@
     flags->topo->description =
         _("Export PostGIS topology instead of simple features");
     flags->topo->guisection = _("Output settings");
+
+    flags->force2d = G_define_flag();
+    flags->force2d->key = '2';
+    flags->force2d->label = _("Force 2D output even if input is 3D ");
+    flags->force2d->description = _("Useful if input is 3D but all z coordinates are identical");
+    flags->force2d->guisection = _("Output settings");
+
 }
 

Modified: grass/trunk/vector/v.out.postgis/local_proto.h
===================================================================
--- grass/trunk/vector/v.out.postgis/local_proto.h	2013-05-24 11:45:07 UTC (rev 56397)
+++ grass/trunk/vector/v.out.postgis/local_proto.h	2013-05-24 12:05:12 UTC (rev 56398)
@@ -8,7 +8,7 @@
 };
 
 struct flags {
-    struct Flag *table, *topo;
+    struct Flag *table, *topo, *force2d;
 };
 
 /* args.c */

Modified: grass/trunk/vector/v.out.postgis/main.c
===================================================================
--- grass/trunk/vector/v.out.postgis/main.c	2013-05-24 11:45:07 UTC (rev 56397)
+++ grass/trunk/vector/v.out.postgis/main.c	2013-05-24 12:05:12 UTC (rev 56398)
@@ -129,7 +129,8 @@
     /* don't use temporary maps, writes vector features immediately to
        the output PostGIS layer */
     putenv("GRASS_VECTOR_EXTERNAL_IMMEDIATE=1");
-    if (-1 == Vect_open_new(&Out, olayer, Vect_is_3d(&In)))
+    if (-1 == Vect_open_new(&Out, olayer,
+                            !flags.force2d->answer ? Vect_is_3d(&In) : WITHOUT_Z))
         G_fatal_error(_("Unable to create PostGIS layer <%s>"),
                       olayer);
     G_add_error_handler(output_handler, &Out);

Modified: grass/trunk/vector/v.out.postgis/v.out.postgis.html
===================================================================
--- grass/trunk/vector/v.out.postgis/v.out.postgis.html	2013-05-24 11:45:07 UTC (rev 56397)
+++ grass/trunk/vector/v.out.postgis/v.out.postgis.html	2013-05-24 12:05:12 UTC (rev 56398)
@@ -66,7 +66,10 @@
 <em>v.out.postgis</em> currently supports only three basic output
 simple feature types: Points, Linestrings and Polygons. Also 3D
 features of the same type are supported, eg. 3D points are exported
-as <tt>PointZ</tt> simple feature. Faces are exported as 3D polygons.
+as <tt>PointZ</tt> simple feature. Faces are exported as 3D
+polygons. 3D features are written to the output automatically if input
+vector map is 3D. If <b>-2</b> flag is given then the output is always
+2D (z-coordinate is silently ignored for 3D input vector maps).
 
 <p>
 Multigeometries are not currently supported. Features with the same
@@ -231,7 +234,7 @@
   <li>Allow mixed features (points, lines)</li>
   <li>Support other simple feature types like GeometryCollection and others</li>
   <li>Implement missing options
-  from <em><a href="v.out.ogr.html">v.out.ogr</a></em>: <b>-a</b>, <b>-s</b>, <b>-c</b>, <b>-2</b>, <b>-p</b>, <b>-n</b></li>
+  from <em><a href="v.out.ogr.html">v.out.ogr</a></em>: <b>-a</b>, <b>-s</b>, <b>-c</b>, <b>-p</b>, <b>-n</b></li>
   <li>Add options: <b>cats</b>, <b>where</b></li>
 </ul>
 



More information about the grass-commit mailing list