[Dive4elements-commits] [PATCH 1 of 2] Importer HWS: case insensitive matching for HWS_KIND and FED_STATES

Wald Commits scm-commit at wald.intevation.org
Fri Feb 15 15:04:01 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1360936640 -3600
# Branch dami
# Node ID baa32f1df47da9b76d5b509dcbb130ca4ddf2c69
# Parent  fed74592a2ba19c3fd333a27ff7da94db16953b1
Importer HWS: case insensitive matching for HWS_KIND and FED_STATES

diff -r fed74592a2ba -r baa32f1df47d flys-backend/contrib/shpimporter/hws.py
--- 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" % \


More information about the Dive4elements-commits mailing list