diff flys-backend/contrib/shpimporter/utils.py @ 3800:69d19995bc3c 2.9.1

merged flys-backend/2.9.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:48 +0200
parents 59ca5dab2782
children b1d7e600b43b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/contrib/shpimporter/utils.py	Fri Sep 28 12:14:48 2012 +0200
@@ -0,0 +1,21 @@
+import os
+from shpimporter import DEBUG, INFO, ERROR
+
+SHP='.shp'
+
+def findShapefiles(path):
+    shapes = []
+
+    for root, dirs, files in os.walk(path):
+        if len(files) == 0:
+            continue
+
+        DEBUG("Processing directory '%s' with %i files " % (root, len(files)))
+
+        for f in files:
+            idx = f.find(SHP)
+            if (idx+len(SHP)) == len(f):
+                shapes.append((f.replace(SHP, ''), root + "/" + f))
+
+    return shapes
+

http://dive4elements.wald.intevation.org