comparison flys-backend/contrib/shpimporter/shpimporter.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 bd9e76e0b55d
comparison
equal deleted inserted replaced
2797:e41d03bf9807 2798:5a654f2e35bc
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

http://dive4elements.wald.intevation.org