Mercurial > dive4elements > river
comparison flys-backend/contrib/shpimporter/fixpoints.py @ 5198:edba92337204
Log error if KM attribute is not set for fixpoints
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 08 Mar 2013 10:29:30 +0100 |
parents | c5187ab9f571 |
children | 71a24278322c |
comparison
equal
deleted
inserted
replaced
5197:f0c47b4beded | 5198:edba92337204 |
---|---|
2 from osgeo import ogr, osr | 2 from osgeo import ogr, osr |
3 except ImportError: | 3 except ImportError: |
4 import ogr, osr | 4 import ogr, osr |
5 | 5 |
6 from importer import Importer | 6 from importer import Importer |
7 import logging | |
8 logger = logging.getLogger("Fixpoints") | |
9 fixpoints_no_km_logged=False | |
7 | 10 |
8 TABLE_NAME="fixpoints" | 11 TABLE_NAME="fixpoints" |
9 PATH="Geodaesie/Festpunkte" | 12 PATH="Geodaesie/Festpunkte" |
10 NAME="Fixpoints" | 13 NAME="Fixpoints" |
11 | 14 |
47 if self.IsFieldSet(feat, "KM"): | 50 if self.IsFieldSet(feat, "KM"): |
48 newFeat.SetField("km", feat.GetFieldAsDouble("KM")) | 51 newFeat.SetField("km", feat.GetFieldAsDouble("KM")) |
49 elif self.IsFieldSet(feat, "ELBE_KM"): | 52 elif self.IsFieldSet(feat, "ELBE_KM"): |
50 newFeat.SetField("km", feat.GetFieldAsDouble("ELBE_KM")) | 53 newFeat.SetField("km", feat.GetFieldAsDouble("ELBE_KM")) |
51 else: | 54 else: |
55 if not fixpoints_no_km_logged: | |
56 logger.error("Could not find KM attribute") | |
57 fixpoints_no_km_logged = True | |
52 return None | 58 return None |
53 | 59 |
54 if self.IsFieldSet(feat, "X"): | 60 if self.IsFieldSet(feat, "X"): |
55 newFeat.SetField("x", feat.GetFieldAsDouble("X")) | 61 newFeat.SetField("x", feat.GetFieldAsDouble("X")) |
56 | 62 |