comparison flys-backend/contrib/shpimporter/importer.py @ 4878:82d00b0c7302

(importer) Avoid uneccessary error and improve debug output
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 25 Jan 2013 10:46:00 +0100
parents 852d4c508f33
children b457532dae63
comparison
equal deleted inserted replaced
4877:852d4c508f33 4878:82d00b0c7302
26 26
27 def getName(self): 27 def getName(self):
28 raise NotImplementedError("Importer.getTablename is abstract!") 28 raise NotImplementedError("Importer.getTablename is abstract!")
29 29
30 def IsFieldSet(self, feat, name): 30 def IsFieldSet(self, feat, name):
31 try: 31 if feat.GetFieldIndex(name) == -1:
32 isset = feat.GetField(name) 32 return False # Avoids an Error in IsFieldSet
33 return isset is not None 33 return feat.IsFieldSet(feat.GetFieldIndex(name))
34 except:
35 return False
36
37 34
38 def IsDoubleFieldSet(self, feat, name): 35 def IsDoubleFieldSet(self, feat, name):
39 try: 36 try:
40 isset = feat.GetFieldAsDouble(name) 37 isset = feat.GetFieldAsDouble(name)
41 return isset is not None 38 return isset is not None
102 99
103 for feat in srcLayer: 100 for feat in srcLayer:
104 geom = feat.GetGeometryRef() 101 geom = feat.GetGeometryRef()
105 102
106 if geom is None: 103 if geom is None:
104 shpimporter.DEBUG("Unkown Geometry reference for feature")
107 continue 105 continue
108 106
109 geomType = geom.GetGeometryType() 107 geomType = geom.GetGeometryType()
110 108
111 if self.isGeometryValid(geomType): 109 if self.isGeometryValid(geomType):

http://dive4elements.wald.intevation.org