Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/shpimporter.py Fri Sep 28 12:14:40 2012 +0200 @@ -0,0 +1,60 @@ +import ogr + +import utils +from uesg import UESG +from axis import Axis +from km import KM +from lines import Line +from fixpoints import Fixpoint +from buildings import Building +from crosssectiontracks import CrosssectionTrack +from floodplains import Floodplain +from boundaries import HydrBoundary, HydrBoundaryPoly +from hws import HWS +from gauges import GaugeLocation +from catchments import Catchment + +DBCONN='OCI:user/pass@host' +PATH='/path/to/Gewaesser/Elbe' +RIVER_ID=the_river_id +DEST_SRS=31467 + + +def getImporters(): + return [ + Axis(DBCONN, RIVER_ID, DEST_SRS), + KM(DBCONN, RIVER_ID, DEST_SRS), + CrosssectionTrack(DBCONN, RIVER_ID, DEST_SRS), + Line(DBCONN, RIVER_ID, DEST_SRS), + Fixpoint(DBCONN, RIVER_ID, DEST_SRS), + Building(DBCONN, RIVER_ID, DEST_SRS), + Floodplain(DBCONN, RIVER_ID, DEST_SRS), + HydrBoundary(DBCONN, RIVER_ID, DEST_SRS), + HydrBoundaryPoly(DBCONN, RIVER_ID, DEST_SRS), + HWS(DBCONN, RIVER_ID, DEST_SRS), + GaugeLocation(DBCONN, RIVER_ID, DEST_SRS), + Catchment(DBCONN, RIVER_ID, DEST_SRS), + UESG(DBCONN, RIVER_ID, DEST_SRS) + ] + + +if __name__ == '__main__': + importers = getImporters() + + types = {} + + for importer in importers: + shapes = utils.findShapefiles(importer.getPath(PATH)) + print "Found %i Shapefiles" % len(shapes) + + for shpTuple in shapes: + geomType = importer.walkOverShapes(shpTuple) + try: + num = types[geomType] + types[geomType] = num+1 + except: + types[geomType] = 1 + + for key in types: + print "%i x geometry type %s" % (types[key], key) +