changeset 5002:baa32f1df47d dami

Importer HWS: case insensitive matching for HWS_KIND and FED_STATES
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 15 Feb 2013 14:57:20 +0100
parents fed74592a2ba
children 563ff8893d47
files flys-backend/contrib/shpimporter/hws.py
diffstat 1 files changed, 30 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/hws.py	Fri Feb 15 12:41:27 2013 +0100
+++ b/flys-backend/contrib/shpimporter/hws.py	Fri Feb 15 14:57:20 2013 +0100
@@ -14,37 +14,38 @@
 
 # Keep in sync with hws_kinds table:
 HWS_KIND = {
-        "Durchlass" : 1,
-        "Damm" : 2,
-        "Deich" : 2,
-        "Hochufer" : 2,
-        "Graben" : 3,
+        "durchlass" : 1,
+        "damm" : 2,
+        "deich" : 2,
+        "hochufer" : 2,
+        "graben" : 3,
+        "rohr1" : 1,
     }
 
 # Keep in sync with fed_states table:
 FED_STATES = {
-    "Bayern" : 1,
-    "Hessen" : 2,
-    "Niedersachsen" : 3,
-    "Nordrhein-Westfalen" : 4,
-    "Nordrhein Westfalen" : 4,
-    "Rheinland-Pfalz" : 5,
-    "Rheinland Pfalz" : 5,
-    "Saarland" : 6,
-    "Schleswig-Holstein" : 7,
-    "Schleswig Holstein" : 7,
-    "Brandenburg" : 8,
-    "Mecklenburg-Vorpommern" : 9,
-    "Mecklenburg Vorpommern" : 9,
-    "Thüringen" : 10,
-    "Baden-Württemberg" : 11,
-    "Baden Württemberg" : 11,
-    "Sachsen-Anhalt" : 12,
-    "Sachsen Anhalt" : 12,
-    "Sachsen" : 13,
-    "Berlin" : 14,
-    "Bremen" : 15,
-    "Hamburg" : 16,
+    "bayern" : 1,
+    "hessen" : 2,
+    "niedersachsen" : 3,
+    "nordrhein-westfalen" : 4,
+    "nordrhein westfalen" : 4,
+    "rheinland-pfalz" : 5,
+    "rheinland pfalz" : 5,
+    "saarland" : 6,
+    "schleswig-holstein" : 7,
+    "schleswig holstein" : 7,
+    "brandenburg" : 8,
+    "mecklenburg-vorpommern" : 9,
+    "mecklenburg vorpommern" : 9,
+    "thüringen" : 10,
+    "baden-württemberg" : 11,
+    "baden württemberg" : 11,
+    "sachsen-anhalt" : 12,
+    "sachsen anhalt" : 12,
+    "sachsen" : 13,
+    "berlin" : 14,
+    "bremen" : 15,
+    "hamburg" : 16,
 }
 
 class HWSPoints(Importer):
@@ -90,7 +91,7 @@
         artname = self.searchField("art$")
         if self.IsFieldSet(feat, artname):
             self.handled(artname)
-            kind_id = HWS_KIND.get(feat.GetField(artname))
+            kind_id = HWS_KIND.get(feat.GetField(artname).lower())
             if not kind_id:
                 print ("Unknown Art: %s" % \
                         feat.GetField(artname))
@@ -100,7 +101,7 @@
         fname = self.searchField("Bundesland$")
         if self.IsFieldSet(feat, fname):
             self.handled(fname)
-            fed_id = FED_STATES.get(feat.GetField(fname))
+            fed_id = FED_STATES.get(feat.GetField(fname).lower())
 
             if not fed_id:
                 print ("Unknown Bundesland: %s" % \

http://dive4elements.wald.intevation.org