diff flys-backend/contrib/shpimporter/utils.py @ 4884:b457532dae63

Importer: Move copy fields into importer class and track imported/unimported fields
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Jan 2013 12:25:24 +0100
parents e9880b224c2f
children 1f6e544f7a7f
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/utils.py	Fri Jan 25 15:43:05 2013 +0100
+++ b/flys-backend/contrib/shpimporter/utils.py	Mon Jan 28 12:25:24 2013 +0100
@@ -31,35 +31,3 @@
     except UnicodeDecodeError:
         # Probably Windows iso-8859-x names so lets try again
         return unicode.encode(unicode(path, "iso-8859-15"), "UTF-8")
-
-
-# 0 OFTInteger, Simple 32bit integer
-# 1 OFTIntegerList, List of 32bit integers
-# 2 OFTReal, Double Precision floating point
-# 3 OFTRealList, List of doubles
-# 4 OFTString, String of ASCII chars
-# 5 OFTStringList, Array of strings
-# 6 OFTWideString, deprecated
-# 7 OFTWideStringList, deprecated
-# 8 OFTBinary, Raw Binary data
-# 9 OFTDate, Date
-# 10 OFTTime, Time
-# 11 OFTDateTime, Date and Time
-
-
-def copyFields(src, target, mapping):
-    """
-    Checks the mapping dictonary for key value pairs to
-    copy from the source to the destination feature.
-
-    The Key is the attribute of the source feature to be copied
-    into the target attribute named by the dict's value.
-    """
-    for key, value in mapping.items():
-        if src.GetFieldIndex(key) == -1:
-            continue
-        if src.IsFieldSet(src.GetFieldIndex(key)):
-            if src.GetFieldType(key) == 2:
-                target.SetField(value, src.GetFieldAsDouble(key))
-            else:
-                target.SetField(value, src.GetField(key))

http://dive4elements.wald.intevation.org