diff flys-backend/contrib/shpimporter/utils.py @ 5294:3f35d9db48c1

Force UESG to multipolygon and import source field for messungen
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 14 Mar 2013 12:45:51 +0100
parents 40dc001594e4
children
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/utils.py	Thu Mar 14 12:44:04 2013 +0100
+++ b/flys-backend/contrib/shpimporter/utils.py	Thu Mar 14 12:45:51 2013 +0100
@@ -108,3 +108,15 @@
     geometry.AssignSpatialReference(srs)
     feature.SetGeometry(geometry)
     return feature
+
+def convertToMultiPolygon(feature):
+    """
+    Converts a feature to a multiline feature.
+    """
+    geometry = feature.GetGeometryRef()
+    # SRS information is lost while forcing to multiline
+    srs = geometry.GetSpatialReference()
+    geometry = ogr.ForceToMultiPolygon(geometry)
+    geometry.AssignSpatialReference(srs)
+    feature.SetGeometry(geometry)
+    return feature

http://dive4elements.wald.intevation.org