Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
2797:e41d03bf9807 | 2798:5a654f2e35bc |
---|---|
1 import os | |
2 | |
3 SHP='.shp' | |
4 | |
5 def findShapefiles(path): | |
6 shapes = [] | |
7 | |
8 for root, dirs, files in os.walk(path): | |
9 if len(files) == 0: | |
10 continue | |
11 | |
12 print "Processing directory '%s' with %i files " % (root, len(files)) | |
13 | |
14 for f in files: | |
15 idx = f.find(SHP) | |
16 if (idx+len(SHP)) == len(f): | |
17 shapes.append((f.replace(SHP, ''), root + "/" + f)) | |
18 | |
19 return shapes | |
20 |