浏览代码

More temporal topology info

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48787 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 13 年之前
父节点
当前提交
18c5908567
共有 1 个文件被更改,包括 30 次插入12 次删除
  1. 30 12
      temporal/t.topology/t.topology.py

+ 30 - 12
temporal/t.topology/t.topology.py

@@ -31,7 +31,7 @@
 #%option
 #% key: type
 #% type: string
-#% description: Type of the space time dataset, default is strds (space time raster dataset)
+#% description: Type of the space time dataset, default is space time raster dataset (strds)
 #% required: no
 #% options: strds, str3ds, stvds
 #% answer: strds
@@ -39,7 +39,17 @@
 
 #%flag
 #% key: t
-#% description: Print temporal relation matrix for space time datasets
+#% description: Print temporal relation matrix and exit
+#%end
+
+#%flag
+#% key: r
+#% description: Print temporal relation count
+#%end
+
+#%flag
+#% key: m
+#% description: Print temporal map type count
 #%end
 
 import grass.script as grass
@@ -53,6 +63,8 @@ def main():
     name = options["input"]
     type = options["type"]
     tmatrix = flags['t']
+    relation = flags['r']
+    map_types = flags['m']
 
     # Make sure the temporal database exists
     tgis.create_temporal_database()
@@ -70,15 +82,6 @@ def main():
         sp = tgis.space_time_raster3d_dataset(id)
     if type == "stvds":
         sp = tgis.space_time_vector_dataset(id)
-    if type == "rast":
-        sp = tgis.raster_dataset(id)
-        tmatrix = False
-    if type == "rast3d":
-        sp = tgis.raster3d_dataset(id)
-        tmatrix = False
-    if type == "vect":
-        sp = tgis.vector_dataset(id)
-        tmatrix = False
 
     if sp.is_in_db() == False:
         grass.fatal("Dataset <" + name + "> not found in temporal database")
@@ -86,14 +89,29 @@ def main():
     # Insert content from db
     sp.select()
 
+    maps = sp.get_registered_maps_as_objects()
+
     if tmatrix:
-        matrix = sp.get_temporal_relation_matrix()
+        matrix = sp.get_temporal_relation_matrix(maps)
 
         for row in matrix:
             for col in row:
                 print col,
             print " "
         print " "
+        return
+
+    if relation:
+        dict = sp.get_temporal_relations_count(maps)
+
+        for key in dict.keys():
+            print key, dict[key]
+
+    if map_types:
+        dict = sp.get_temporal_map_type_count(maps)
+        
+        for key in dict.keys():
+            print key, dict[key]
 
 if __name__ == "__main__":
     options, flags = grass.parser()