File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
90
90
vectorFileName += " .shp" ;
91
91
}
92
92
93
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
93
94
// check for unique fieldnames
94
95
QSet<QString> fieldNames;
95
96
QgsFieldMap::const_iterator fldIt;
@@ -105,6 +106,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
105
106
}
106
107
fieldNames << name;
107
108
}
109
+ #endif
108
110
109
111
deleteShapeFile ( vectorFileName );
110
112
}
@@ -329,6 +331,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
329
331
int ogrIdx = OGR_FD_GetFieldIndex ( defn, mCodec ->fromUnicode ( attrField.name () ) );
330
332
if ( ogrIdx < 0 )
331
333
{
334
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
332
335
// if we didn't find our new column, assume it's name was truncated and
333
336
// it was the last one added (like for shape files)
334
337
int fieldCount = OGR_FD_GetFieldCount ( defn );
@@ -343,6 +346,10 @@ QgsVectorFileWriter::QgsVectorFileWriter(
343
346
ogrIdx = fieldCount - 1 ;
344
347
}
345
348
}
349
+ #else
350
+ // GDAL 1.7 not just truncates, but launders more aggressivly.
351
+ ogrIdx = OGR_FD_GetFieldCount ( defn ) - 1 ;
352
+ #endif
346
353
347
354
if ( ogrIdx < 0 )
348
355
{
You can’t perform that action at this time.
0 commit comments