Mercurial > dive4elements > river
comparison flys-backend/contrib/shpimporter/shpimporter.py @ 3471:e4250c6e1538 2.8.1
merged flys-backend/2.8.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:40 +0200 |
parents | 998f1a7dcfde |
children | 59ca5dab2782 |
comparison
equal
deleted
inserted
replaced
3468:f37e7e8907cb | 3471:e4250c6e1538 |
---|---|
1 import ogr | |
2 | |
3 import utils | |
4 from uesg import UESG | |
5 from axis import Axis | |
6 from km import KM | |
7 from lines import Line | |
8 from fixpoints import Fixpoint | |
9 from buildings import Building | |
10 from crosssectiontracks import CrosssectionTrack | |
11 from floodplains import Floodplain | |
12 from boundaries import HydrBoundary, HydrBoundaryPoly | |
13 from hws import HWS | |
14 from gauges import GaugeLocation | |
15 from catchments import Catchment | |
16 | |
17 DBCONN='OCI:user/pass@host' | |
18 PATH='/path/to/Gewaesser/Elbe' | |
19 RIVER_ID=the_river_id | |
20 DEST_SRS=31467 | |
21 | |
22 | |
23 def getImporters(): | |
24 return [ | |
25 Axis(DBCONN, RIVER_ID, DEST_SRS), | |
26 KM(DBCONN, RIVER_ID, DEST_SRS), | |
27 CrosssectionTrack(DBCONN, RIVER_ID, DEST_SRS), | |
28 Line(DBCONN, RIVER_ID, DEST_SRS), | |
29 Fixpoint(DBCONN, RIVER_ID, DEST_SRS), | |
30 Building(DBCONN, RIVER_ID, DEST_SRS), | |
31 Floodplain(DBCONN, RIVER_ID, DEST_SRS), | |
32 HydrBoundary(DBCONN, RIVER_ID, DEST_SRS), | |
33 HydrBoundaryPoly(DBCONN, RIVER_ID, DEST_SRS), | |
34 HWS(DBCONN, RIVER_ID, DEST_SRS), | |
35 GaugeLocation(DBCONN, RIVER_ID, DEST_SRS), | |
36 Catchment(DBCONN, RIVER_ID, DEST_SRS), | |
37 UESG(DBCONN, RIVER_ID, DEST_SRS) | |
38 ] | |
39 | |
40 | |
41 if __name__ == '__main__': | |
42 importers = getImporters() | |
43 | |
44 types = {} | |
45 | |
46 for importer in importers: | |
47 shapes = utils.findShapefiles(importer.getPath(PATH)) | |
48 print "Found %i Shapefiles" % len(shapes) | |
49 | |
50 for shpTuple in shapes: | |
51 geomType = importer.walkOverShapes(shpTuple) | |
52 try: | |
53 num = types[geomType] | |
54 types[geomType] = num+1 | |
55 except: | |
56 types[geomType] = 1 | |
57 | |
58 for key in types: | |
59 print "%i x geometry type %s" % (types[key], key) | |
60 |