[GRASS-SVN] r66184 - grass/trunk/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 12 15:09:48 PDT 2015
Author: martinl
Date: 2015-09-12 15:09:48 -0700 (Sat, 12 Sep 2015)
New Revision: 66184
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: wrong projection check when importing geometry column from table with multiple geometry columns (#2740)
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2015-09-12 18:51:40 UTC (rev 66183)
+++ grass/trunk/vector/v.in.ogr/main.c 2015-09-12 22:09:48 UTC (rev 66184)
@@ -544,9 +544,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