Skip to content

Instantly share code, notes, and snippets.

@jef-n
Last active August 29, 2015 14:00
Show Gist options
  • Save jef-n/d9332cb8bf6b71292741 to your computer and use it in GitHub Desktop.
Save jef-n/d9332cb8bf6b71292741 to your computer and use it in GitHub Desktop.
commit 27a2e5c2e2293c317ea48332216e35b8cf252105
Author: Juergen E. Fischer <[email protected]>
Date: Thu May 1 23:36:38 2014 +0200
ogr2ogr: turn string value to one element list if destination field is stringlist
diff --git a/ogr/ogrfeature.cpp b/ogr/ogrfeature.cpp
index 5f89758..c9ed2dc 100644
--- a/ogr/ogrfeature.cpp
+++ b/ogr/ogrfeature.cpp
@@ -2399,6 +2399,14 @@ void OGRFeature::SetField( int iField, const char * pszValue )
CSLDestroy(papszValueList);
}
+ else if ( poFDefn->GetType() == OFTStringList )
+ {
+ if( pszValue && *pszValue )
+ {
+ const char *papszValues[2] = { pszValue, 0 };
+ SetField( iField, (char **) papszValues );
+ }
+ }
else
/* do nothing for other field types */;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment