Kaynağa Gözat

v.out.ogr: change logic for 3D data (sync with v.in.ogr)
if input is 3D then output is also 3D (currently only Shapefiles supported)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56361 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 12 yıl önce
ebeveyn
işleme
606b979cab

+ 6 - 5
vector/v.out.ogr/args.c

@@ -95,11 +95,12 @@ void parse_args(int argc, char **argv,
 				      "(applies to Shapefile output only)");
     flags->esristyle->guisection = _("Creation");
 
-    flags->shapez = G_define_flag();
-    flags->shapez->key = 'z';
-    flags->shapez->description = _("Create 3D output if input is 3D "
-       			      "(applies to Shapefile output only)");
-    flags->shapez->guisection = _("Creation");
+    flags->force2d = G_define_flag();
+    flags->force2d->key = '2';
+    flags->force2d->label = _("Force 2D output even if input is 3D "
+                              "(applies to Shapefile output only)");
+    flags->force2d->description = _("Useful if input is 3D but all z coordinates are identical");
+    flags->force2d->guisection = _("Creation");
 
     flags->poly = G_define_flag();
     flags->poly->key = 'p';

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

@@ -16,7 +16,7 @@ struct Options {
 };
 
 struct Flags {
-    struct Flag *cat, *esristyle, *poly, *update, *nocat, *new, *append, *shapez;
+    struct Flag *cat, *esristyle, *poly, *update, *nocat, *new, *append, *force2d;
 };
 
 /* args.c */

+ 5 - 4
vector/v.out.ogr/main.c

@@ -462,10 +462,11 @@ int main(int argc, char *argv[])
 	flags.append->answer = FALSE;
     }
     
-    /* Automatically append driver options for 3D output to
-       layer creation options if 'z' is given.*/
-    if ((flags.shapez->answer) && (Vect_is_3d(&In)) && (strcmp(options.format->answer,
-							       "ESRI_Shapefile") == 0)) {
+    /* Automatically append driver options for 3D output to layer
+       creation options if '2' is not given.*/
+    if (!flags.force2d->answer &&
+        Vect_is_3d(&In) && 
+        strcmp(options.format->answer, "ESRI_Shapefile") == 0) {
 	/* find right option */
 	char shape_geom[20];
 	if ((otype & GV_POINTS) || (otype & GV_KERNEL))