Mercurial > dive4elements > river
comparison flys-backend/contrib/shpimporter/shpimporter.py @ 3820:8a75cf0841b1 pre2.7-2012-03-16
merged flys-backend/pre2.7-2012-03-16
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:59 +0200 |
parents | 5a654f2e35bc |
children | bd9e76e0b55d |
comparison
equal
deleted
inserted
replaced
3818:dc18457b1cef | 3820:8a75cf0841b1 |
---|---|
1 import ogr | |
2 import utils | |
3 from uesg import UESG | |
4 | |
5 DBCONN='PG:dbname=flystest1 host=localhost user=flys password=flys port=5432' | |
6 PATH='/**/**/**/flys3-testdaten/Saar/Hydrologie/UeSG/Berechnung' | |
7 | |
8 | |
9 def getImporter(): | |
10 return UESG(DBCONN) | |
11 | |
12 | |
13 if __name__ == '__main__': | |
14 shapes = utils.findShapefiles(PATH) | |
15 print "Found %i Shapefiles" % len(shapes) | |
16 | |
17 types = {} | |
18 importer = getImporter() | |
19 | |
20 for shpTuple in shapes: | |
21 geomType = importer.walkOverShapes(shpTuple) | |
22 try: | |
23 num = types[geomType] | |
24 types[geomType] = num+1 | |
25 except: | |
26 types[geomType] = 1 | |
27 | |
28 for key in types: | |
29 print "%i x geometry type %s" % (types[key], key) | |
30 |