소스 검색

v.out.postgis: added force2D flag (see v.out.ogr)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56398 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 년 전
부모
커밋
ee5ee39d31
4개의 변경된 파일15개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 0
      vector/v.out.postgis/args.c
  2. 1 1
      vector/v.out.postgis/local_proto.h
  3. 2 1
      vector/v.out.postgis/main.c
  4. 5 2
      vector/v.out.postgis/v.out.postgis.html

+ 7 - 0
vector/v.out.postgis/args.c

@@ -68,5 +68,12 @@ void define_options(struct params *params, struct flags *flags)
     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");
+
 }
 

+ 1 - 1
vector/v.out.postgis/local_proto.h

@@ -8,7 +8,7 @@ struct params {
 };
 
 struct flags {
-    struct Flag *table, *topo;
+    struct Flag *table, *topo, *force2d;
 };
 
 /* args.c */

+ 2 - 1
vector/v.out.postgis/main.c

@@ -129,7 +129,8 @@ int main(int argc, char *argv[])
     /* 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);

+ 5 - 2
vector/v.out.postgis/v.out.postgis.html

@@ -66,7 +66,10 @@ details).
 <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 @@ page</a>.
   <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>