[PATCH] DGM-importer: enforce a < b for ranges

Wald Commits scm-commit at wald.intevation.org
Thu Sep 12 19:15:13 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1379006107 -7200
# Branch double-precision
# Node ID bb5bd48b80f66e7c8bcd0ad252ec0534ed882b23
# Parent  3d83a4cf33badfee252ed1a1bace96c5d76dc81b
DGM-importer: enforce a < b for ranges.

diff -r 3d83a4cf33ba -r bb5bd48b80f6 backend/contrib/shpimporter/dgm.py
--- a/backend/contrib/shpimporter/dgm.py	Thu Sep 12 18:58:19 2013 +0200
+++ b/backend/contrib/shpimporter/dgm.py	Thu Sep 12 19:15:07 2013 +0200
@@ -122,8 +122,10 @@
                     else:
                         values.append(unicode.encode(
                             fields[namedict[val]], "UTF-8"))
-                km_von = fields[namedict["km_von"]]
-                km_bis = fields[namedict["km_bis"]]
+                km_von = min(float(fields[namedict["km_von"]]), 
+                    float(fields[namedict["km_bis"]]))
+                km_bis = max(float(fields[namedict["km_von"]]), 
+                    float(fields[namedict["km_bis"]]))
                 year_from = None
                 year_to = None
                 try:


More information about the Dive4elements-commits mailing list