Mercurial > dive4elements > river
diff flys-backend/contrib/shpimporter/importer.py @ 4995:998b29c8d2fd dami
Improve debug output for unsupported features and skipped shapefiles
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 15 Feb 2013 11:51:58 +0100 |
parents | a92241d40228 |
children | fed74592a2ba |
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/importer.py Thu Feb 14 17:45:13 2013 +0100 +++ b/flys-backend/contrib/shpimporter/importer.py Fri Feb 15 11:51:58 2013 +0100 @@ -77,15 +77,18 @@ def walkOverShapes(self, shape): (name, path) = shape - if not self.isShapeRelevant(name, path): - shpimporter.INFO("Skip shapefile '%s'" % path) - return shp = ogr.Open(shape[1]) if shp is None: shpimporter.ERROR("Shapefile '%s' could not be opened!" % path) return + if not self.isShapeRelevant(name, path): + shpimporter.INFO("Skip shapefile: '%s' of Type: %s" % (path, + utils.getWkbString(shp.GetLayerByName(name).GetGeomType()))) + return + + shpimporter.INFO("Processing shapefile '%s'" % path) srcLayer = shp.GetLayerByName(name) @@ -172,7 +175,7 @@ geomType = -1 success = 0 - unsupported = 0 + unsupported = {} creationFailed = 0 featureDef = destLayer.GetLayerDefn() @@ -206,11 +209,13 @@ else: creationFailed = creationFailed + 1 else: - unsupported = unsupported + 1 + unsupported[utils.getWkbString(geomType)] = \ + unsupported.get(utils.getWkbString(geomType), 0) + 1 shpimporter.INFO("Inserted %i features" % success) shpimporter.INFO("Failed to create %i features" % creationFailed) - shpimporter.INFO("Found %i unsupported features" % unsupported) + for key, value in unsupported: + shpimporter.INFO("Found %i unsupported features of type: %s" % (value, key)) if self.tracking_import: unhandled = []