Mercurial > dive4elements > river
diff flys-backend/contrib/shpimporter/utils.py @ 2798:5a654f2e35bc
Added a python tool to import shapefiles into database.
flys-backend/trunk@4127 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 07 Mar 2012 20:37:03 +0000 |
parents | |
children | 59ca5dab2782 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/utils.py Wed Mar 07 20:37:03 2012 +0000 @@ -0,0 +1,20 @@ +import os + +SHP='.shp' + +def findShapefiles(path): + shapes = [] + + for root, dirs, files in os.walk(path): + if len(files) == 0: + continue + + print "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 +