[GRASS-SVN] r74137 - grass/trunk/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 28 01:02:06 PST 2019
Author: mmetz
Date: 2019-02-28 01:02:06 -0800 (Thu, 28 Feb 2019)
New Revision: 74137
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: set spatial filter to correct geometry field if geom option is given
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2019-02-27 15:11:08 UTC (rev 74136)
+++ grass/trunk/vector/v.in.ogr/main.c 2019-02-28 09:02:06 UTC (rev 74137)
@@ -768,7 +768,22 @@
for (layer = 0; layer < nlayers; layer++) {
Ogr_layer = ds_getlayerbyindex(Ogr_ds, layers[layer]);
+#if GDAL_VERSION_NUM >= 1110000
+ if (param.geom->answer) {
+ 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 input layer <%s>"),
+ param.geom->answer, OGR_L_GetName(Ogr_layer));
+
+ OGR_L_SetSpatialFilterEx(Ogr_layer, igeom, poSpatialFilter[layer]);
+ }
+ else {
+ OGR_L_SetSpatialFilter(Ogr_layer, poSpatialFilter[layer]);
+ }
+#else
OGR_L_SetSpatialFilter(Ogr_layer, poSpatialFilter[layer]);
+#endif
if (OGR_L_SetAttributeFilter(Ogr_layer, attr_filter) != OGRERR_NONE)
G_fatal_error(_("Error setting attribute filter '%s'"),
attr_filter);
More information about the grass-commit
mailing list