Esempio n. 1
0
 def _validate_geometry(geom):
     if geom is not None:
         simple = models.DBSession.query(func.ST_IsSimple(geom)).scalar()
         if not simple:
             raise TopologicalError("Not simple")
         valid = models.DBSession.query(func.ST_IsValid(geom)).scalar()
         if not valid:
             reason = models.DBSession.query(func.ST_IsValidReason(geom)).scalar()
             raise TopologicalError(reason)
Esempio n. 2
0
 def _validate_geometry(self, geom):
     validate = self.settings.get("geometry_validation", False)
     if validate and geom is not None:
         simple = DBSession.query(func.ST_IsSimple(geom)).scalar()
         if not simple:
             raise TopologicalError("Not simple")
         valid = DBSession.query(func.ST_IsValid(geom)).scalar()
         if not valid:
             reason = DBSession.query(func.ST_IsValidReason(geom)).scalar()
             raise TopologicalError(reason)