[GRASS-SVN] r66187 - grass/branches/releasebranch_7_0/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 13 05:24:32 PDT 2015


Author: martinl
Date: 2015-09-13 05:24:32 -0700 (Sun, 13 Sep 2015)
New Revision: 66187

Modified:
   grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c
Log:
v.in.ogr: wrong projection check when importing geometry column from table with multiple geometry columns (#2740)
          (merge r66184 from trunk)


Modified: grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c	2015-09-12 23:09:23 UTC (rev 66186)
+++ grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c	2015-09-13 12:24:32 UTC (rev 66187)
@@ -531,9 +531,25 @@
     /* Fetch input map projection in GRASS form. */
     proj_info = NULL;
     proj_units = NULL;
+#if GDAL_VERSION_NUM >= 1110000
+    if (param.geom->answer) {
+        OGRGeomFieldDefnH Ogr_geomdefn;
+        
+        Ogr_featuredefn = OGR_L_GetLayerDefn(Ogr_layer);
+        igeom = OGR_FD_GetGeomFieldIndex(Ogr_featuredefn, param.geom->answer);
+        if (igeom < 0)
+            G_fatal_error(_("Geometry column <%s> not found in OGR layer <%s>"),
+                          param.geom->answer, OGR_L_GetName(Ogr_layer));
+        Ogr_geomdefn = OGR_FD_GetGeomFieldDefn(Ogr_featuredefn, igeom);
+        Ogr_projection = OGR_GFld_GetSpatialRef(Ogr_geomdefn);
+    }
+    else {
+        Ogr_projection = OGR_L_GetSpatialRef(Ogr_layer);
+    }
+#else
     Ogr_projection = OGR_L_GetSpatialRef(Ogr_layer);	/* should not be freed later */
+#endif
 
-
     /* fetch boundaries */
     G_get_window(&cellhd);
     if ((OGR_L_GetExtent(Ogr_layer, &oExt, 1)) == OGRERR_NONE) {



More information about the grass-commit mailing list