[GRASS-SVN] r38584 - grass/branches/develbranch_6/vector/v.out.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 2 14:05:19 EDT 2009
Author: mmetz
Date: 2009-08-02 14:05:19 -0400 (Sun, 02 Aug 2009)
New Revision: 38584
Modified:
grass/branches/develbranch_6/vector/v.out.ogr/main.c
Log:
fix for #634
Modified: grass/branches/develbranch_6/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.out.ogr/main.c 2009-08-02 18:00:03 UTC (rev 38583)
+++ grass/branches/develbranch_6/vector/v.out.ogr/main.c 2009-08-02 18:05:19 UTC (rev 38584)
@@ -171,8 +171,14 @@
/* Check output type */
otype = Vect_option_to_types(type_opt);
- if (!layer_opt->answer)
- layer_opt->answer = G_store(in_opt->answer);
+ if (!layer_opt->answer) {
+ char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+
+ if (G__name_is_fully_qualified(in_opt->answer, xname, xmapset))
+ layer_opt->answer = G_store(xname);
+ else
+ layer_opt->answer = G_store(in_opt->answer);
+ }
if (otype & GV_POINTS)
wkbtype = wkbPoint;
@@ -231,7 +237,6 @@
}
/* Open OGR DSN */
- OGRRegisterAll();
G_debug(2, "driver count = %d", OGRGetDriverCount());
drn = -1;
for (i = 0; i < OGRGetDriverCount(); i++) {
@@ -259,7 +264,7 @@
i++;
}
- papszDSCO = dsco->answers;
+ G_debug(1, "Create OGR data source");
Ogr_ds = OGR_Dr_CreateDataSource(Ogr_driver, dsn_opt->answer, papszDSCO);
CSLDestroy(papszDSCO);
if (Ogr_ds == NULL)
@@ -298,6 +303,7 @@
}
}
+ G_debug(1, "Create OGR layer");
Ogr_layer =
OGR_DS_CreateLayer(Ogr_ds, layer_opt->answer, Ogr_projection, wkbtype,
papszLCO);
@@ -309,6 +315,7 @@
/* Vector attributes -> OGR fields */
if (field > 0) {
+ G_debug(1, "Create attribute table");
doatt = 1; /* do attributes */
Fi = Vect_get_field(&In, field);
if (Fi == NULL) {
@@ -316,6 +323,7 @@
Ogr_field = OGR_Fld_Create("cat", OFTInteger);
OGR_L_CreateField(Ogr_layer, Ogr_field, 0);
+ OGR_Fld_Destroy(Ogr_field);
doatt = 0;
}
@@ -372,6 +380,7 @@
Ogr_field =
OGR_Fld_Create(db_get_column_name(Column), ogr_ftype);
OGR_L_CreateField(Ogr_layer, Ogr_field, 0);
+ OGR_Fld_Destroy(Ogr_field);
}
if (keycol == -1)
G_fatal_error(_("Key column '%s' not found"), Fi->key);
@@ -604,6 +613,8 @@
OGR_G_AddGeometryDirectly(Ogr_geometry, ring);
+ OGR_F_SetGeometry(Ogr_feature, Ogr_geometry);
+
/* Output one feature for each category */
for (j = -1; j < Cats->n_cats; j++) {
if (j == -1) {
@@ -621,8 +632,6 @@
OGR_L_CreateFeature(Ogr_layer, Ogr_feature);
}
- OGR_F_SetGeometry(Ogr_feature, Ogr_geometry);
-
OGR_G_DestroyGeometry(Ogr_geometry);
} /* if type & GV_FACE */
More information about the grass-commit
mailing list