Sfoglia il codice sorgente

Handle empty maps ids

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53286 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 12 anni fa
parent
commit
869e371ffc

+ 9 - 5
lib/python/temporal/base.py

@@ -660,13 +660,17 @@ class DatasetBase(SQLDatabaseInterface):
            without layer information
 
            @param return the name of the vector map as name@mapset
+                  or None in case the id was not set
         """
-        if self.id.find(":") >= 0:
-            # Remove the layer identifier from the id
-            return self.id.split("@")[0].split(":")[0] + "@" + \
-                   self.id.split("@")[1]
+        if self.id:
+            if self.id.find(":") >= 0:
+                # Remove the layer identifier from the id
+                return self.id.split("@")[0].split(":")[0] + "@" + \
+                       self.id.split("@")[1]
+            else:
+                return self.id
         else:
-            return self.id
+            return None
 
     def get_layer(self):
         """!Convenient method to get the layer of the map (part of primary key)

+ 1 - 1
raster/rasterintro.html

@@ -135,7 +135,7 @@ that the values are samples at each raster cell's centre, and samples the surfac
 at each region cell's centre.</li>
 <li><a href="r.resamp.bspline.html">r.resamp.bspline</a> Bicubic or bilinear 
 spline interpolation with Tykhonov regularization.</li>
-<li>For <a href="r.resamp.stats.html">r.resamp.stats</a> without <b>-w</b>, the value of 
+<li>For <a href="r.resamp.stats.html">r.resamp.stats</a> without <b>-w</b>, the value of
 each region cell is the chosen aggregate of the values from all of the raster
 cells whose centres fall within the bounds of the region cell.
 <br>

+ 1 - 3
temporal/t.rast.out.vtk/t.rast.out.vtk.py

@@ -123,10 +123,8 @@ def main():
     if maps is not None:
         for map in maps:
             if use_granularity:
-                if len(map) > 0:
+                if map and len(map) > 0:
                     id = map[0].get_map_id()
-                else:
-                    continue
             else:
                 id = map.get_map_id()
             # None ids will be replaced by NULL maps