Selaa lähdekoodia

more robust way of getting WFS geometry

Jachym Cepicky 14 vuotta sitten
vanhempi
commit
9fca05ca11
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4 3
      wfs/__init__.py

+ 4 - 3
wfs/__init__.py

@@ -144,11 +144,12 @@ class WFS(OWS):
         """
 
         geomType = layer.GetGeomType()
-        if geomType == 0:
+        if geomType == 0: # unknown
             # brutal force way
             f = layer.GetNextFeature()
-            gr = f.GetGeometryRef()
-            geomType = gr.GetGeometryType()
+            if f:
+                gr = f.GetGeometryRef()
+                geomType = gr.GetGeometryType()
 
         if geomType in [ogr.wkbPolygon,
                         ogr.wkbMultiPolygon,