瀏覽代碼

Implementing spatial buffering and direct extent object exchange for map objects. Removed spaces.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57379 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 11 年之前
父節點
當前提交
17de822661

+ 89 - 84
lib/python/temporal/abstract_dataset.py

@@ -39,30 +39,30 @@ class ImplementationError(Exception):
         self.msg = msg
         self.msg = msg
     def __str__(self):
     def __str__(self):
         return repr(self.msg)
         return repr(self.msg)
-    
+
 ###############################################################################
 ###############################################################################
 
 
 class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetConnector):
 class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetConnector):
-    """!This is the base class for all datasets 
+    """!This is the base class for all datasets
        (raster, vector, raster3d, strds, stvds, str3ds)"""
        (raster, vector, raster3d, strds, stvds, str3ds)"""
-    
+
     __metaclass__ = ABCMeta
     __metaclass__ = ABCMeta
-    
+
     def __init__(self):
     def __init__(self):
         SpatialTopologyDatasetConnector.__init__(self)
         SpatialTopologyDatasetConnector.__init__(self)
         TemporalTopologyDatasetConnector.__init__(self)
         TemporalTopologyDatasetConnector.__init__(self)
-        
+
     def reset_topology(self):
     def reset_topology(self):
         """!Reset any information about temporal topology"""
         """!Reset any information about temporal topology"""
         self.reset_spatial_topology()
         self.reset_spatial_topology()
         self.reset_temporal_topology()
         self.reset_temporal_topology()
-        
-    def get_number_of_relations(self):      
+
+    def get_number_of_relations(self):
         """! Return a dictionary in which the keys are the relation names and the value
         """! Return a dictionary in which the keys are the relation names and the value
         are the number of relations.
         are the number of relations.
-        
+
         The following relations are available:
         The following relations are available:
-        
+
         Spatial relations
         Spatial relations
         - equivalent
         - equivalent
         - overlap
         - overlap
@@ -71,7 +71,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         - meet
         - meet
         - cover
         - cover
         - covered
         - covered
-        
+
         Temporal relations
         Temporal relations
         - equal
         - equal
         - follows
         - follows
@@ -84,10 +84,10 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         - started
         - started
         - finishes
         - finishes
         - finished
         - finished
-       
+
         To access topological information the spatial, temporal or booth topologies must be build first
         To access topological information the spatial, temporal or booth topologies must be build first
         using the SpatioTemporalTopologyBuilder.
         using the SpatioTemporalTopologyBuilder.
-        
+
         @return the dictionary with relations as keys and number as values or None in case the topology  wasn't build
         @return the dictionary with relations as keys and number as values or None in case the topology  wasn't build
         """
         """
         if self.is_temporal_topology_build() and not self.is_spatial_topology_build():
         if self.is_temporal_topology_build() and not self.is_spatial_topology_build():
@@ -97,14 +97,14 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         else:
         else:
             return  self.get_number_of_temporal_relations() + \
             return  self.get_number_of_temporal_relations() + \
                     self.get_number_of_spatial_relations()
                     self.get_number_of_spatial_relations()
-            
+
         return None
         return None
 
 
     def set_topology_build_true(self):
     def set_topology_build_true(self):
         """!Use this method when the spatio-temporal topology was build"""
         """!Use this method when the spatio-temporal topology was build"""
         self.set_spatial_topology_build_true()
         self.set_spatial_topology_build_true()
         self.set_temporal_topology_build_true()
         self.set_temporal_topology_build_true()
-        
+
 
 
     def set_topology_build_false(self):
     def set_topology_build_false(self):
         """!Use this method when the spatio-temporal topology was not build"""
         """!Use this method when the spatio-temporal topology was not build"""
@@ -113,53 +113,53 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
     def is_topology_build(self):
     def is_topology_build(self):
         """!Check if the spatial and temporal topology was build
         """!Check if the spatial and temporal topology was build
-        
+
            @return A dictionary with "spatial" and "temporal" as keys that have boolen values
            @return A dictionary with "spatial" and "temporal" as keys that have boolen values
         """
         """
         d = {}
         d = {}
         d["spatial"] = self.is_spatial_topology_build()
         d["spatial"] = self.is_spatial_topology_build()
         d["temporal"] = self.is_temporal_topology_build()
         d["temporal"] = self.is_temporal_topology_build()
-        
+
         return d
         return d
-        
+
 
 
     def print_topology_info(self):
     def print_topology_info(self):
         if self.is_temporal_topology_build():
         if self.is_temporal_topology_build():
             self.print_temporal_topology_info()
             self.print_temporal_topology_info()
         if self.is_spatial_topology_build():
         if self.is_spatial_topology_build():
             self.print_spatial_topology_info()
             self.print_spatial_topology_info()
-            
+
     def print_topology_shell_info(self):
     def print_topology_shell_info(self):
         if self.is_temporal_topology_build():
         if self.is_temporal_topology_build():
             self.print_temporal_topology_shell_info()
             self.print_temporal_topology_shell_info()
         if self.is_spatial_topology_build():
         if self.is_spatial_topology_build():
             self.print_spatial_topology_shell_info()
             self.print_spatial_topology_shell_info()
-            
+
     @abstractmethod
     @abstractmethod
     def reset(self, ident):
     def reset(self, ident):
         """!Reset the internal structure and set the identifier
         """!Reset the internal structure and set the identifier
-        
+
             This method creates the dataset specific internal objects
             This method creates the dataset specific internal objects
             that store the base information, the spatial and temporal extent
             that store the base information, the spatial and temporal extent
             and the metadata. It must be implemented in the dataset
             and the metadata. It must be implemented in the dataset
-            specific subclasses. This is the code for the 
+            specific subclasses. This is the code for the
             vector dataset:
             vector dataset:
-            
+
             self.base = VectorBase(ident=ident)
             self.base = VectorBase(ident=ident)
             self.absolute_time = VectorAbsoluteTime(ident=ident)
             self.absolute_time = VectorAbsoluteTime(ident=ident)
             self.relative_time = VectorRelativeTime(ident=ident)
             self.relative_time = VectorRelativeTime(ident=ident)
             self.spatial_extent = VectorSpatialExtent(ident=ident)
             self.spatial_extent = VectorSpatialExtent(ident=ident)
             self.metadata = VectorMetadata(ident=ident)
             self.metadata = VectorMetadata(ident=ident)
-        
+
            @param ident The identifier of the dataset that  "name@mapset" or in case of vector maps "name:layer@mapset"
            @param ident The identifier of the dataset that  "name@mapset" or in case of vector maps "name:layer@mapset"
         """
         """
 
 
     @abstractmethod
     @abstractmethod
     def get_type(self):
     def get_type(self):
         """!Return the type of this class as string
         """!Return the type of this class as string
-           
-           The type can be "vect", "rast", "rast3d", "stvds", "strds" or "str3ds" 
-           
+
+           The type can be "vect", "rast", "rast3d", "stvds", "strds" or "str3ds"
+
            @return "vect", "rast", "rast3d", "stvds", "strds" or "str3ds"
            @return "vect", "rast", "rast3d", "stvds", "strds" or "str3ds"
         """
         """
 
 
@@ -174,41 +174,41 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
     @abstractmethod
     @abstractmethod
     def spatial_overlapping(self, dataset):
     def spatial_overlapping(self, dataset):
         """!Return True if the spatial extents overlap
         """!Return True if the spatial extents overlap
-        
+
            @param dataset The abstract dataset to check spatial overlapping
            @param dataset The abstract dataset to check spatial overlapping
            @return True if self and the provided dataset spatial overlap
            @return True if self and the provided dataset spatial overlap
         """
         """
 
 
     @abstractmethod
     @abstractmethod
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the spatial intersection as spatial_extent 
+        """!Return the spatial intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent
            @return The intersection spatial extent
         """
         """
 
 
     @abstractmethod
     @abstractmethod
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the spatial union as spatial_extent 
+        """!Return the spatial union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
-    
+
     @abstractmethod
     @abstractmethod
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the spatial union as spatial_extent object.
         """!Return the spatial union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
-    
+
     @abstractmethod
     @abstractmethod
     def spatial_relation(self, dataset):
     def spatial_relation(self, dataset):
         """!Return the spatial relationship between self and dataset
         """!Return the spatial relationship between self and dataset
-        
+
            @param dataset The abstract dataset to compute the spatial relation with self
            @param dataset The abstract dataset to compute the spatial relation with self
            @return The spatial relationship as string
            @return The spatial relationship as string
         """
         """
@@ -252,10 +252,10 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
     def get_temporal_extent_as_tuple(self):
     def get_temporal_extent_as_tuple(self):
         """!Returns a tuple of the valid start and end time
         """!Returns a tuple of the valid start and end time
-        
+
            Start and end time can be either of type datetime or of type integer,
            Start and end time can be either of type datetime or of type integer,
            depending on the temporal type.
            depending on the temporal type.
-           
+
            @return A tuple of (start_time, end_time)
            @return A tuple of (start_time, end_time)
         """
         """
         start = self.temporal_extent.get_start_time()
         start = self.temporal_extent.get_start_time()
@@ -263,16 +263,16 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return (start, end)
         return (start, end)
 
 
     def get_absolute_time(self):
     def get_absolute_time(self):
-        """!Returns the start time, the end 
+        """!Returns the start time, the end
            time and the timezone of the map as tuple
            time and the timezone of the map as tuple
-           
+
            @attention: The timezone is currently not used.
            @attention: The timezone is currently not used.
-           
+
            The start time is of type datetime.
            The start time is of type datetime.
-           
-           The end time is of type datetime in case of interval time, 
+
+           The end time is of type datetime in case of interval time,
            or None on case of a time instance.
            or None on case of a time instance.
-           
+
            @return A tuple of (start_time, end_time, timezone)
            @return A tuple of (start_time, end_time, timezone)
         """
         """
 
 
@@ -283,14 +283,14 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return (start, end, tz)
         return (start, end, tz)
 
 
     def get_relative_time(self):
     def get_relative_time(self):
-        """!Returns the start time, the end 
+        """!Returns the start time, the end
            time and the temporal unit of the dataset as tuple
            time and the temporal unit of the dataset as tuple
-           
+
            The start time is of type integer.
            The start time is of type integer.
-           
-           The end time is of type integer in case of interval time, 
+
+           The end time is of type integer in case of interval time,
            or None on case of a time instance.
            or None on case of a time instance.
-           
+
            @return A tuple of (start_time, end_time, unit)
            @return A tuple of (start_time, end_time, unit)
         """
         """
 
 
@@ -307,14 +307,14 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return self.relative_time.get_unit()
         return self.relative_time.get_unit()
 
 
     def check_relative_time_unit(self, unit):
     def check_relative_time_unit(self, unit):
-        """!Check if unit is of type  year(s), month(s), day(s), hour(s), 
+        """!Check if unit is of type  year(s), month(s), day(s), hour(s),
            minute(s) or second(s)
            minute(s) or second(s)
 
 
            @param unit The unit string
            @param unit The unit string
            @return True if success, False otherwise
            @return True if success, False otherwise
         """
         """
         # Check unit
         # Check unit
-        units = ["year", "years", "month", "months", "day", "days", "hour", 
+        units = ["year", "years", "month", "months", "day", "days", "hour",
                  "hours", "minute", "minutes", "second", "seconds"]
                  "hours", "minute", "minutes", "second", "seconds"]
         if unit not in units:
         if unit not in units:
             return False
             return False
@@ -322,30 +322,35 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
     def get_temporal_type(self):
     def get_temporal_type(self):
         """!Return the temporal type of this dataset
         """!Return the temporal type of this dataset
-        
+
            The temporal type can be absolute or relative
            The temporal type can be absolute or relative
-           
+
            @return The temporal type of the dataset as string
            @return The temporal type of the dataset as string
         """
         """
         return self.base.get_ttype()
         return self.base.get_ttype()
 
 
     def get_spatial_extent_as_tuple(self):
     def get_spatial_extent_as_tuple(self):
         """!Return the spatial extent as tuple
         """!Return the spatial extent as tuple
-        
+
            Top and bottom are set to 0 in case of a two dimensional spatial extent.
            Top and bottom are set to 0 in case of a two dimensional spatial extent.
-           
-           @return A the spatial extent as tuple (north, south, east, west, top, bottom) 
+
+           @return A the spatial extent as tuple (north, south, east, west, top, bottom)
         """
         """
         return self.spatial_extent.get_spatial_extent_as_tuple()
         return self.spatial_extent.get_spatial_extent_as_tuple()
 
 
+    def get_spatial_extent(self):
+        """!Return the spatial extent
+        """
+        return self.spatial_extent
+
     def select(self, dbif=None):
     def select(self, dbif=None):
-        """!Select temporal dataset entry from database and fill 
+        """!Select temporal dataset entry from database and fill
            the internal structure
            the internal structure
-           
+
            The content of every dataset is stored in the temporal database.
            The content of every dataset is stored in the temporal database.
-           This method must be used to fill this object with the content 
+           This method must be used to fill this object with the content
            from the temporal database.
            from the temporal database.
-           
+
            @param dbif The database interface to be used
            @param dbif The database interface to be used
         """
         """
 
 
@@ -367,16 +372,16 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         """
         """
         return self.base.is_in_db(dbif)
         return self.base.is_in_db(dbif)
 
 
+    @abstractmethod
     def delete(self):
     def delete(self):
         """!Delete dataset from database if it exists"""
         """!Delete dataset from database if it exists"""
-        raise ImplementationError("This method must be implemented in the subclasses")
 
 
     def insert(self, dbif=None, execute=True):
     def insert(self, dbif=None, execute=True):
         """!Insert dataset into database
         """!Insert dataset into database
 
 
            @param dbif The database interface to be used
            @param dbif The database interface to be used
            @param execute If True the SQL statements will be executed.
            @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are returned 
+                           If False the prepared SQL statements are returned
                            and must be executed by the caller.
                            and must be executed by the caller.
             @return The SQL insert statement in case execute=False, or an empty string otherwise
             @return The SQL insert statement in case execute=False, or an empty string otherwise
         """
         """
@@ -388,7 +393,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         statement += self.temporal_extent.get_insert_statement_mogrified(dbif)
         statement += self.temporal_extent.get_insert_statement_mogrified(dbif)
         statement += self.spatial_extent.get_insert_statement_mogrified(dbif)
         statement += self.spatial_extent.get_insert_statement_mogrified(dbif)
         statement += self.metadata.get_insert_statement_mogrified(dbif)
         statement += self.metadata.get_insert_statement_mogrified(dbif)
-        
+
         if execute:
         if execute:
             dbif.execute_transaction(statement)
             dbif.execute_transaction(statement)
             if connected:
             if connected:
@@ -405,7 +410,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
            @param dbif The database interface to be used
            @param dbif The database interface to be used
            @param execute If True the SQL statements will be executed.
            @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are returned 
+                           If False the prepared SQL statements are returned
                            and must be executed by the caller.
                            and must be executed by the caller.
            @param ident The identifier to be updated, useful for renaming
            @param ident The identifier to be updated, useful for renaming
            @return The SQL update statement in case execute=False, or an empty string otherwise
            @return The SQL update statement in case execute=False, or an empty string otherwise
@@ -415,9 +420,9 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
         # Build the UPDATE SQL statement
         # Build the UPDATE SQL statement
         statement = self.base.get_update_statement_mogrified(dbif, ident)
         statement = self.base.get_update_statement_mogrified(dbif, ident)
-        statement += self.temporal_extent.get_update_statement_mogrified(dbif, 
+        statement += self.temporal_extent.get_update_statement_mogrified(dbif,
                                                                          ident)
                                                                          ident)
-        statement += self.spatial_extent.get_update_statement_mogrified(dbif, 
+        statement += self.spatial_extent.get_update_statement_mogrified(dbif,
                                                                         ident)
                                                                         ident)
         statement += self.metadata.get_update_statement_mogrified(dbif, ident)
         statement += self.metadata.get_update_statement_mogrified(dbif, ident)
 
 
@@ -437,7 +442,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
            @param dbif The database interface to be used
            @param dbif The database interface to be used
            @param execute If True the SQL statements will be executed.
            @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are returned 
+                           If False the prepared SQL statements are returned
                            and must be executed by the caller.
                            and must be executed by the caller.
            @param ident The identifier to be updated, useful for renaming
            @param ident The identifier to be updated, useful for renaming
            @return The SQL update statement in case execute=False, or an empty string otherwise
            @return The SQL update statement in case execute=False, or an empty string otherwise
@@ -447,7 +452,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
         # Build the UPDATE SQL statement
         # Build the UPDATE SQL statement
         statement = self.base.get_update_all_statement_mogrified(dbif, ident)
         statement = self.base.get_update_all_statement_mogrified(dbif, ident)
-        statement += self.temporal_extent.get_update_all_statement_mogrified(dbif, 
+        statement += self.temporal_extent.get_update_all_statement_mogrified(dbif,
                                                                              ident)
                                                                              ident)
         statement += self.spatial_extent.get_update_all_statement_mogrified(
         statement += self.spatial_extent.get_update_all_statement_mogrified(
             dbif, ident)
             dbif, ident)
@@ -465,7 +470,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
     def is_time_absolute(self):
     def is_time_absolute(self):
         """!Return True in case the temporal type is absolute
         """!Return True in case the temporal type is absolute
-        
+
             @return True if temporal type is absolute, False otherwise
             @return True if temporal type is absolute, False otherwise
         """
         """
         if "temporal_type" in self.base.D:
         if "temporal_type" in self.base.D:
@@ -475,14 +480,14 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
 
     def is_time_relative(self):
     def is_time_relative(self):
         """!Return True in case the temporal type is relative
         """!Return True in case the temporal type is relative
-        
+
             @return True if temporal type is relative, False otherwise
             @return True if temporal type is relative, False otherwise
         """
         """
         if "temporal_type" in self.base.D:
         if "temporal_type" in self.base.D:
             return self.base.get_ttype() == "relative"
             return self.base.get_ttype() == "relative"
         else:
         else:
             return None
             return None
-    
+
     def _get_temporal_extent(self):
     def _get_temporal_extent(self):
         """!Return the temporal extent of the correct internal type
         """!Return the temporal extent of the correct internal type
         """
         """
@@ -491,49 +496,49 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         if self.is_time_relative():
         if self.is_time_relative():
             return self.relative_time
             return self.relative_time
         return None
         return None
-    
+
     temporal_extent = property(fget=_get_temporal_extent)
     temporal_extent = property(fget=_get_temporal_extent)
 
 
     def temporal_relation(self, dataset):
     def temporal_relation(self, dataset):
         """!Return the temporal relation of self and the provided dataset
         """!Return the temporal relation of self and the provided dataset
-        
+
             @return The temporal relation as string
             @return The temporal relation as string
         """
         """
         return self.temporal_extent.temporal_relation(dataset.temporal_extent)
         return self.temporal_extent.temporal_relation(dataset.temporal_extent)
-    
+
     def temporal_intersection(self, dataset):
     def temporal_intersection(self, dataset):
         """!Intersect self with the provided dataset and
         """!Intersect self with the provided dataset and
            return a new temporal extent with the new start and end time
            return a new temporal extent with the new start and end time
-           
+
            @param dataset The abstract dataset to temporal intersect with
            @param dataset The abstract dataset to temporal intersect with
-           @return The new temporal extent with start and end time, 
+           @return The new temporal extent with start and end time,
                    or None in case of no intersection
                    or None in case of no intersection
         """
         """
         return self.temporal_extent.intersect(dataset.temporal_extent)
         return self.temporal_extent.intersect(dataset.temporal_extent)
-        
+
     def temporal_union(self, dataset):
     def temporal_union(self, dataset):
         """!Creates a union with the provided dataset and
         """!Creates a union with the provided dataset and
            return a new temporal extent with the new start and end time.
            return a new temporal extent with the new start and end time.
-           
+
            @param dataset The abstract dataset to create temporal union with
            @param dataset The abstract dataset to create temporal union with
-           @return The new temporal extent with start and end time, 
+           @return The new temporal extent with start and end time,
                    or None in case of no intersection
                    or None in case of no intersection
         """
         """
         return self.temporal_extent.union(dataset.temporal_extent)
         return self.temporal_extent.union(dataset.temporal_extent)
-        
+
     def temporal_disjoint_union(self, dataset):
     def temporal_disjoint_union(self, dataset):
         """!Creates a union with the provided dataset and
         """!Creates a union with the provided dataset and
            return a new temporal extent with the new start and end time.
            return a new temporal extent with the new start and end time.
-           
+
            @param dataset The abstract dataset to create temporal union with
            @param dataset The abstract dataset to create temporal union with
            @return The new temporal extent with start and end time
            @return The new temporal extent with start and end time
         """
         """
         return self.temporal_extent.disjoint_union(dataset.temporal_extent)
         return self.temporal_extent.disjoint_union(dataset.temporal_extent)
-        
+
 ###############################################################################
 ###############################################################################
 
 
 class AbstractDatasetComparisonKeyStartTime(object):
 class AbstractDatasetComparisonKeyStartTime(object):
-    """!This comparison key can be used to sort lists of abstract datasets 
+    """!This comparison key can be used to sort lists of abstract datasets
        by start time
        by start time
 
 
         Example:
         Example:
@@ -581,7 +586,7 @@ class AbstractDatasetComparisonKeyStartTime(object):
 ###############################################################################
 ###############################################################################
 
 
 class AbstractDatasetComparisonKeyEndTime(object):
 class AbstractDatasetComparisonKeyEndTime(object):
-    """!This comparison key can be used to sort lists of abstract datasets 
+    """!This comparison key can be used to sort lists of abstract datasets
        by end time
        by end time
 
 
         Example:
         Example:
@@ -627,7 +632,7 @@ class AbstractDatasetComparisonKeyEndTime(object):
         return endA != endB
         return endA != endB
 
 
 ###############################################################################
 ###############################################################################
-        
+
 if __name__ == "__main__":
 if __name__ == "__main__":
     import doctest
     import doctest
     doctest.testmod()
     doctest.testmod()

+ 122 - 10
lib/python/temporal/abstract_map_dataset.py

@@ -36,9 +36,9 @@ class AbstractMapDataset(AbstractDataset):
         - Abstract methods that must be implemented in the map specific
         - Abstract methods that must be implemented in the map specific
           subclasses
           subclasses
     """
     """
-    
+
     __metaclass__ = ABCMeta
     __metaclass__ = ABCMeta
-    
+
     def __init__(self):
     def __init__(self):
         AbstractDataset.__init__(self)
         AbstractDataset.__init__(self)
 
 
@@ -207,7 +207,7 @@ class AbstractMapDataset(AbstractDataset):
         self.temporal_extent.print_self()
         self.temporal_extent.print_self()
         self.spatial_extent.print_self()
         self.spatial_extent.print_self()
         self.metadata.print_self()
         self.metadata.print_self()
-        
+
     def print_info(self):
     def print_info(self):
         """!Print information about this object in human readable style"""
         """!Print information about this object in human readable style"""
 
 
@@ -328,7 +328,7 @@ class AbstractMapDataset(AbstractDataset):
     def set_time_to_relative(self):
     def set_time_to_relative(self):
         """!Set the temporal type to relative"""
         """!Set the temporal type to relative"""
         self.base.set_ttype("relative")
         self.base.set_ttype("relative")
-        
+
     def set_absolute_time(self, start_time, end_time=None, timezone=None):
     def set_absolute_time(self, start_time, end_time=None, timezone=None):
         """!Set the absolute time with start time and end time
         """!Set the absolute time with start time and end time
 
 
@@ -348,7 +348,7 @@ class AbstractMapDataset(AbstractDataset):
             if self.get_layer() is not None:
             if self.get_layer() is not None:
                 core.fatal(_("Start time must be of type datetime for %(type)s"
                 core.fatal(_("Start time must be of type datetime for %(type)s"
                              " map <%(id)s> with layer: %(l)s") % {
                              " map <%(id)s> with layer: %(l)s") % {
-                             'type': self.get_type(), 'id': self.get_map_id(), 
+                             'type': self.get_type(), 'id': self.get_map_id(),
                              'l': self.get_layer()})
                              'l': self.get_layer()})
             else:
             else:
                 core.fatal(_("Start time must be of type datetime for "
                 core.fatal(_("Start time must be of type datetime for "
@@ -507,6 +507,43 @@ class AbstractMapDataset(AbstractDataset):
 
 
         self.write_timestamp_to_grass()
         self.write_timestamp_to_grass()
 
 
+    def set_temporal_extent(self, temporal_extent):
+        """!Convenient method to set the temporal extent from a temporal extent object
+
+           @param temporal_extent The temporal axtent that should be set for this object
+
+           @code
+           >>> import datetime
+           >>> import grass.temporal as tgis
+           >>> map      = tgis.RasterDataset(None)
+           >>> temp_ext = tgis.RelativeTemporalExtent(start_time=1, end_time=2, unit="years")
+           >>> map.set_temporal_extent(temp_ext)
+           >>> print map.get_temporal_extent_as_tuple()
+           (1, 2)
+           >>> map      = tgis.VectorDataset(None)
+           >>> temp_ext = tgis.AbsoluteTemporalExtent(start_time=datetime.datetime(2000, 1, 1),
+           ...                                        end_time=datetime.datetime(2001, 1, 1))
+           >>> map.set_temporal_extent(temp_ext)
+           >>> print map.get_temporal_extent_as_tuple()
+           (datetime.datetime(2000, 1, 1, 0, 0), datetime.datetime(2001, 1, 1, 0, 0))
+
+           @endcode
+        """
+
+        if issubclass(RelativeTemporalExtent, type(temporal_extent)):
+            start = temporal_extent.get_start_time()
+            end = temporal_extent.get_end_time()
+            unit = temporal_extent.get_unit()
+
+            self.set_relative_time(start, end, unit)
+
+        elif issubclass(AbsoluteTemporalExtent, type(temporal_extent)):
+            start = temporal_extent.get_start_time()
+            end = temporal_extent.get_end_time()
+            tz = temporal_extent.get_timezone()
+
+            self.set_absolute_time(start, end, tz)
+
     def temporal_buffer(self, increment, update=False, dbif=None):
     def temporal_buffer(self, increment, update=False, dbif=None):
         """!Create a temporal buffer based on an increment
         """!Create a temporal buffer based on an increment
 
 
@@ -610,8 +647,8 @@ class AbstractMapDataset(AbstractDataset):
             else:
             else:
                 self.set_relative_time(new_start, new_end, unit)
                 self.set_relative_time(new_start, new_end, unit)
 
 
-    def set_spatial_extent(self, north, south, east, west, top=0, bottom=0):
-        """!Set the spatial extent of the map
+    def set_spatial_extent_from_values(self, north, south, east, west, top=0, bottom=0):
+        """!Set the spatial extent of the map from values
 
 
             This method only modifies this object and does not commit
             This method only modifies this object and does not commit
             the modifications to the temporal database.
             the modifications to the temporal database.
@@ -623,9 +660,84 @@ class AbstractMapDataset(AbstractDataset):
            @param top The top edge
            @param top The top edge
            @param bottom The bottom edge
            @param bottom The bottom edge
         """
         """
-        self.spatial_extent.set_spatial_extent(
+        self.spatial_extent.set_spatial_extent_from_values(
             north, south, east, west, top, bottom)
             north, south, east, west, top, bottom)
 
 
+    def set_spatial_extent(self, spatial_extent):
+        """!Set the spatial extent of the map
+
+            This method only modifies this object and does not commit
+            the modifications to the temporal database.
+
+            @param spatial_extent An object of type SpatialExtent or its subclasses
+
+           @code
+           >>> import datetime
+           >>> import grass.temporal as tgis
+           >>> map      = tgis.RasterDataset(None)
+           >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
+           >>> map.set_spatial_extent(spat_ext)
+           >>> print map.get_spatial_extent_as_tuple()
+           (10.0, -10.0, 20.0, -20.0, 5.0, -5.0)
+
+           @endcode
+        """
+        self.spatial_extent.set_spatial_extent(spatial_extent)
+
+    def spatial_buffer(self, size, update=False, dbif=None):
+        """!Buffer the spatial extent by a given size in all
+           spatial directions.
+
+           @param size The buffer size, using the unit of the grass region
+
+           @code
+
+           >>> import grass.temporal as tgis
+           >>> map = tgis.RasterDataset(None)
+           >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
+           >>> map.set_spatial_extent(spat_ext)
+           >>> map.spatial_buffer(10)
+           >>> print map.get_spatial_extent_as_tuple()
+           (20.0, -20.0, 30.0, -30.0, 15.0, -15.0)
+
+           @endcode
+        """
+        self.spatial_extent.north   += size
+        self.spatial_extent.south   -= size
+        self.spatial_extent.east    += size
+        self.spatial_extent.west    -= size
+        self.spatial_extent.top     += size
+        self.spatial_extent.bottom  -= size
+
+        if update:
+            self.spatial_extent.update(dbif)
+
+    def spatial_buffer_2d(self, size, update=False, dbif=None):
+        """!Buffer the spatial extent by a given size in 2d
+           spatial directions.
+
+           @param size The buffer size, using the unit of the grass region
+
+           @code
+
+           >>> import grass.temporal as tgis
+           >>> map = tgis.RasterDataset(None)
+           >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
+           >>> map.set_spatial_extent(spat_ext)
+           >>> map.spatial_buffer_2d(10)
+           >>> print map.get_spatial_extent_as_tuple()
+           (20.0, -20.0, 30.0, -30.0, 5.0, -5.0)
+
+           @endcode
+        """
+        self.spatial_extent.north   += size
+        self.spatial_extent.south   -= size
+        self.spatial_extent.east    += size
+        self.spatial_extent.west    -= size
+
+        if update:
+            self.spatial_extent.update(dbif)
+
     def check_for_correct_time(self):
     def check_for_correct_time(self):
         """!Check for correct time"""
         """!Check for correct time"""
         if self.is_time_absolute():
         if self.is_time_absolute():
@@ -696,7 +808,7 @@ class AbstractMapDataset(AbstractDataset):
             #core.verbose(_("Delete %s dataset <%s> from temporal database")
             #core.verbose(_("Delete %s dataset <%s> from temporal database")
             #             % (self.get_type(), self.get_id()))
             #             % (self.get_type(), self.get_id()))
 
 
-            # Delete yourself from the database, trigger functions will 
+            # Delete yourself from the database, trigger functions will
             # take care of dependencies
             # take care of dependencies
             statement += self.base.get_delete_statement()
             statement += self.base.get_delete_statement()
 
 
@@ -736,7 +848,7 @@ class AbstractMapDataset(AbstractDataset):
         #if self.get_layer() is not None:
         #if self.get_layer() is not None:
         #    core.verbose(_("Unregister %(type)s map <%(map)s> with "
         #    core.verbose(_("Unregister %(type)s map <%(map)s> with "
         #                   "layer %(layer)s from space time datasets" % \
         #                   "layer %(layer)s from space time datasets" % \
-        #                 {'type':self.get_type(), 'map':self.get_map_id(), 
+        #                 {'type':self.get_type(), 'map':self.get_map_id(),
         #                  'layer':self.get_layer()}))
         #                  'layer':self.get_layer()}))
         #else:
         #else:
         #    core.verbose(_("Unregister %(type)s map <%(map)s> "
         #    core.verbose(_("Unregister %(type)s map <%(map)s> "

+ 16 - 16
lib/python/temporal/abstract_space_time_dataset.py

@@ -32,9 +32,9 @@ class AbstractSpaceTimeDataset(AbstractDataset):
        database, like the computation of the temporal and spatial extent as
        database, like the computation of the temporal and spatial extent as
        well as the collecting of metadata.
        well as the collecting of metadata.
     """
     """
-    
+
     __metaclass__ = ABCMeta
     __metaclass__ = ABCMeta
-    
+
     def __init__(self, ident):
     def __init__(self, ident):
         AbstractDataset.__init__(self)
         AbstractDataset.__init__(self)
         self.reset(ident)
         self.reset(ident)
@@ -63,7 +63,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
 
            @param ident The unique identifier of the new object
            @param ident The unique identifier of the new object
         """
         """
-        
+
     @abstractmethod
     @abstractmethod
     def get_map_register(self):
     def get_map_register(self):
         """!Return the name of the map register table
         """!Return the name of the map register table
@@ -120,11 +120,11 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         self.metadata.print_shell_info()
         self.metadata.print_shell_info()
 
 
     def print_history(self):
     def print_history(self):
-        """!Print history information about this class in human readable 
+        """!Print history information about this class in human readable
             shell style
             shell style
         """
         """
         self.metadata.print_history()
         self.metadata.print_history()
-        
+
     def set_initial_values(self, temporal_type, semantic_type,
     def set_initial_values(self, temporal_type, semantic_type,
                            title=None, description=None):
                            title=None, description=None):
         """!Set the initial values of the space time dataset
         """!Set the initial values of the space time dataset
@@ -1041,7 +1041,8 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                                           self.get_relative_time_unit())
                                           self.get_relative_time_unit())
                 # The fast way
                 # The fast way
                 if has_bt_columns:
                 if has_bt_columns:
-                    map.set_spatial_extent(west=row["west"], east=row["east"],
+                    map.set_spatial_extent_from_values(west=row["west"],
+                                                       east=row["east"],
                                            south=row["south"], top=row["top"],
                                            south=row["south"], top=row["top"],
                                            north=row["north"],
                                            north=row["north"],
                                            bottom=row["bottom"])
                                            bottom=row["bottom"])
@@ -1491,16 +1492,15 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         # Get the update statement, we update the table entry of the old
         # Get the update statement, we update the table entry of the old
         # identifier
         # identifier
         statement = self.update(dbif, execute=False, ident=old_ident)
         statement = self.update(dbif, execute=False, ident=old_ident)
-
         # We need to rename the raster register table
         # We need to rename the raster register table
-        statement += "ALTER TABLE %s RENAME TO \'%s\';\n" % \
+        statement += "ALTER TABLE %s RENAME TO \"%s\";\n" % \
                      (old_map_register_table, new_map_register_table)
                      (old_map_register_table, new_map_register_table)
 
 
         # We need to rename the space time dataset in the maps register table
         # We need to rename the space time dataset in the maps register table
         if maps:
         if maps:
             for map in maps:
             for map in maps:
                 map.select()
                 map.select()
-                statement += "UPDATE %s SET id = \'%s\' WHERE id = \'%s\';\n"%\
+                statement += "UPDATE %s SET id = \"%s\" WHERE id = \"%s\";\n"%\
                              (map.get_stds_register(), ident, old_ident)
                              (map.get_stds_register(), ident, old_ident)
 
 
         # Execute the accumulated statements
         # Execute the accumulated statements
@@ -1656,7 +1656,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                 dbif)
                 dbif)
             # Commented because of performance issue calling g.message thousend times
             # Commented because of performance issue calling g.message thousend times
             #core.verbose(_("Set temporal unit for space time %s dataset "
             #core.verbose(_("Set temporal unit for space time %s dataset "
-            #               "<%s> to %s") % (map.get_type(), self.get_id(), 
+            #               "<%s> to %s") % (map.get_type(), self.get_id(),
             #                                map_rel_time_unit))
             #                                map_rel_time_unit))
 
 
         stds_rel_time_unit = self.get_relative_time_unit()
         stds_rel_time_unit = self.get_relative_time_unit()
@@ -1739,11 +1739,11 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             #if map.get_layer():
             #if map.get_layer():
             #    core.verbose(_("Created register table <%s> for "
             #    core.verbose(_("Created register table <%s> for "
             #                   "%s map <%s> with layer %s") %
             #                   "%s map <%s> with layer %s") %
-            #                    (map_register_table, map.get_type(), 
+            #                    (map_register_table, map.get_type(),
             #                     map.get_map_id(), map.get_layer()))
             #                     map.get_map_id(), map.get_layer()))
             #else:
             #else:
             #    core.verbose(_("Created register table <%s> for %s map <%s>") %
             #    core.verbose(_("Created register table <%s> for %s map <%s>") %
-            #                    (map_register_table, map.get_type(), 
+            #                    (map_register_table, map.get_type(),
             #                     map.get_map_id()))
             #                     map.get_map_id()))
 
 
         # We need to create the table and register it
         # We need to create the table and register it
@@ -2002,7 +2002,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         else:
         else:
             # Check if the end time is smaller than the maximum start time
             # Check if the end time is smaller than the maximum start time
             if self.is_time_absolute():
             if self.is_time_absolute():
-                sql = """SELECT max(start_time) FROM GRASS_MAP_absolute_time 
+                sql = """SELECT max(start_time) FROM GRASS_MAP_absolute_time
                          WHERE GRASS_MAP_absolute_time.id IN
                          WHERE GRASS_MAP_absolute_time.id IN
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register);"""
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register);"""
                 sql = sql.replace("GRASS_MAP", self.get_new_map_instance(
                 sql = sql.replace("GRASS_MAP", self.get_new_map_instance(
@@ -2010,7 +2010,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                 sql = sql.replace("SPACETIME_NAME",
                 sql = sql.replace("SPACETIME_NAME",
                     stds_name + "_" + stds_mapset)
                     stds_name + "_" + stds_mapset)
             else:
             else:
-                sql = """SELECT max(start_time) FROM GRASS_MAP_relative_time 
+                sql = """SELECT max(start_time) FROM GRASS_MAP_relative_time
                          WHERE GRASS_MAP_relative_time.id IN
                          WHERE GRASS_MAP_relative_time.id IN
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register);"""
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register);"""
                 sql = sql.replace("GRASS_MAP", self.get_new_map_instance(
                 sql = sql.replace("GRASS_MAP", self.get_new_map_instance(
@@ -2046,7 +2046,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         if use_start_time:
         if use_start_time:
             if self.is_time_absolute():
             if self.is_time_absolute():
                 sql = """UPDATE STDS_absolute_time SET end_time =
                 sql = """UPDATE STDS_absolute_time SET end_time =
-               (SELECT max(start_time) FROM GRASS_MAP_absolute_time WHERE 
+               (SELECT max(start_time) FROM GRASS_MAP_absolute_time WHERE
                GRASS_MAP_absolute_time.id IN
                GRASS_MAP_absolute_time.id IN
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
                ) WHERE id = 'SPACETIME_ID';"""
                ) WHERE id = 'SPACETIME_ID';"""
@@ -2058,7 +2058,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                 sql = sql.replace("STDS", self.get_type())
                 sql = sql.replace("STDS", self.get_type())
             elif self.is_time_relative():
             elif self.is_time_relative():
                 sql = """UPDATE STDS_relative_time SET end_time =
                 sql = """UPDATE STDS_relative_time SET end_time =
-               (SELECT max(start_time) FROM GRASS_MAP_relative_time WHERE 
+               (SELECT max(start_time) FROM GRASS_MAP_relative_time WHERE
                GRASS_MAP_relative_time.id IN
                GRASS_MAP_relative_time.id IN
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
                ) WHERE id = 'SPACETIME_ID';"""
                ) WHERE id = 'SPACETIME_ID';"""

+ 88 - 88
lib/python/temporal/space_time_datasets.py

@@ -14,7 +14,7 @@ for details.
 
 
 >>> grass.run_command("r3.mapcalc", overwrite=True, expression="str3ds_map_test_case = 1")
 >>> grass.run_command("r3.mapcalc", overwrite=True, expression="str3ds_map_test_case = 1")
 0
 0
->>> grass.run_command("v.random", overwrite=True, output="stvds_map_test_case", 
+>>> grass.run_command("v.random", overwrite=True, output="stvds_map_test_case",
 ... n=100, zmin=0, zmax=100, flags="z", column="elevation")
 ... n=100, zmin=0, zmax=100, flags="z", column="elevation")
 0
 0
 
 
@@ -38,25 +38,25 @@ class RasterDataset(AbstractMapDataset):
 
 
        This class provides functions to select, update, insert or delete raster
        This class provides functions to select, update, insert or delete raster
        map information and valid time stamps into the SQL temporal database.
        map information and valid time stamps into the SQL temporal database.
-       
+
        Usage:
        Usage:
-        
+
         @code
         @code
-        
+
         >>> import grass.script as grass
         >>> import grass.script as grass
         >>> init()
         >>> init()
         >>> grass.use_temp_region()
         >>> grass.use_temp_region()
-        >>> grass.run_command("g.region", n=80.0, s=0.0, e=120.0, w=0.0, 
+        >>> grass.run_command("g.region", n=80.0, s=0.0, e=120.0, w=0.0,
         ... t=1.0, b=0.0, res=10.0)
         ... t=1.0, b=0.0, res=10.0)
         0
         0
-        >>> grass.run_command("r.mapcalc", overwrite=True, 
+        >>> grass.run_command("r.mapcalc", overwrite=True,
         ... expression="strds_map_test_case = 1")
         ... expression="strds_map_test_case = 1")
         0
         0
         >>> mapset = grass.gisenv()["MAPSET"]
         >>> mapset = grass.gisenv()["MAPSET"]
         >>> name = "strds_map_test_case"
         >>> name = "strds_map_test_case"
         >>> identifier = "%s@%s" % (name, mapset)
         >>> identifier = "%s@%s" % (name, mapset)
         >>> rmap = RasterDataset(identifier)
         >>> rmap = RasterDataset(identifier)
-        >>> rmap.set_absolute_time(start_time=datetime(2001,1,1), 
+        >>> rmap.set_absolute_time(start_time=datetime(2001,1,1),
         ...                        end_time=datetime(2012,1,1))
         ...                        end_time=datetime(2012,1,1))
         True
         True
         >>> rmap.map_exists()
         >>> rmap.map_exists()
@@ -85,7 +85,7 @@ class RasterDataset(AbstractMapDataset):
          | Minimum value:.............. 1.0
          | Minimum value:.............. 1.0
          | Maximum value:.............. 1.0
          | Maximum value:.............. 1.0
          | STRDS register table ....... None
          | STRDS register table ....... None
-         
+
         >>> newmap = rmap.get_new_instance("new@PERMANENT")
         >>> newmap = rmap.get_new_instance("new@PERMANENT")
         >>> isinstance(newmap, RasterDataset)
         >>> isinstance(newmap, RasterDataset)
         True
         True
@@ -111,11 +111,11 @@ class RasterDataset(AbstractMapDataset):
         True
         True
         >>> rmap.is_time_relative()
         >>> rmap.is_time_relative()
         False
         False
-        
+
         >>> grass.run_command("g.remove", rast=name)
         >>> grass.run_command("g.remove", rast=name)
         0
         0
         >>> grass.del_temp_region()
         >>> grass.del_temp_region()
-        
+
         @endcode
         @endcode
     """
     """
     def __init__(self, ident):
     def __init__(self, ident):
@@ -130,17 +130,17 @@ class RasterDataset(AbstractMapDataset):
         return RasterDataset(ident)
         return RasterDataset(ident)
 
 
     def get_new_stds_instance(self, ident):
     def get_new_stds_instance(self, ident):
-        """!Return a new space time dataset instance in which maps 
+        """!Return a new space time dataset instance in which maps
         are stored with the type of this class"""
         are stored with the type of this class"""
         return SpaceTimeRasterDataset(ident)
         return SpaceTimeRasterDataset(ident)
 
 
     def get_stds_register(self):
     def get_stds_register(self):
-        """!Return the space time dataset register table name in which stds 
+        """!Return the space time dataset register table name in which stds
         are listed in which this map is registered"""
         are listed in which this map is registered"""
         return self.metadata.get_strds_register()
         return self.metadata.get_strds_register()
 
 
     def set_stds_register(self, name):
     def set_stds_register(self, name):
-        """!Set the space time dataset register table name in which stds 
+        """!Set the space time dataset register table name in which stds
         are listed in which this map is registered"""
         are listed in which this map is registered"""
         self.metadata.set_strds_register(name)
         self.metadata.set_strds_register(name)
 
 
@@ -153,43 +153,43 @@ class RasterDataset(AbstractMapDataset):
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
 
 
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the two dimensional intersection as spatial_extent 
+        """!Return the two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent or None
            @return The intersection spatial extent or None
         """
         """
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
 
 
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the two dimensional union as spatial_extent 
+        """!Return the two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent or None
            @return The union spatial extent or None
         """
         """
         return self.spatial_extent.union_2d(dataset.spatial_extent)
         return self.spatial_extent.union_2d(dataset.spatial_extent)
-    
+
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the two dimensional union as spatial_extent object.
         """!Return the two dimensional union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
-    
+
     def get_np_array(self):
     def get_np_array(self):
         """!Return this raster map as memmap numpy style array to access the raster
         """!Return this raster map as memmap numpy style array to access the raster
            values in numpy style without loading the whole map in the RAM.
            values in numpy style without loading the whole map in the RAM.
 
 
-           In case this raster map does exists in the grass spatial database, 
-           the map will be exported using r.out.bin to a temporary location 
+           In case this raster map does exists in the grass spatial database,
+           the map will be exported using r.out.bin to a temporary location
            and assigned to the memmap object that is returned by this function.
            and assigned to the memmap object that is returned by this function.
 
 
-           In case the raster map does not exists, an empty temporary 
+           In case the raster map does not exists, an empty temporary
            binary file will be created and assigned to the memap object.
            binary file will be created and assigned to the memap object.
 
 
-           You need to call the write function to write the memmap 
+           You need to call the write function to write the memmap
            array back into grass.
            array back into grass.
         """
         """
 
 
@@ -217,7 +217,7 @@ class RasterDataset(AbstractMapDataset):
             return False
             return False
 
 
     def write_timestamp_to_grass(self):
     def write_timestamp_to_grass(self):
-        """!Write the timestamp of this map into the map metadata in 
+        """!Write the timestamp of this map into the map metadata in
            the grass file system based spatial database.
            the grass file system based spatial database.
 
 
            Internally the libgis API functions are used for writing
            Internally the libgis API functions are used for writing
@@ -237,7 +237,7 @@ class RasterDataset(AbstractMapDataset):
                          (self.get_map_id())))
                          (self.get_map_id())))
 
 
     def remove_timestamp_from_grass(self):
     def remove_timestamp_from_grass(self):
-        """!Remove the timestamp from the grass file system based 
+        """!Remove the timestamp from the grass file system based
            spatial database
            spatial database
 
 
            Internally the libgis API functions are used for removal
            Internally the libgis API functions are used for removal
@@ -350,7 +350,7 @@ class RasterDataset(AbstractMapDataset):
 
 
         # Fill spatial extent
         # Fill spatial extent
 
 
-        self.set_spatial_extent(north=kvp["north"], south=kvp["south"],
+        self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
                                 east=kvp["east"], west=kvp["west"])
                                 east=kvp["east"], west=kvp["west"])
 
 
         # Fill metadata
         # Fill metadata
@@ -390,17 +390,17 @@ class Raster3DDataset(AbstractMapDataset):
         return Raster3DDataset(ident)
         return Raster3DDataset(ident)
 
 
     def get_new_stds_instance(self, ident):
     def get_new_stds_instance(self, ident):
-        """!Return a new space time dataset instance in which maps 
+        """!Return a new space time dataset instance in which maps
         are stored with the type of this class"""
         are stored with the type of this class"""
         return SpaceTimeRaster3DDataset(ident)
         return SpaceTimeRaster3DDataset(ident)
 
 
     def get_stds_register(self):
     def get_stds_register(self):
-        """!Return the space time dataset register table name in 
+        """!Return the space time dataset register table name in
         which stds are listed in which this map is registered"""
         which stds are listed in which this map is registered"""
         return self.metadata.get_str3ds_register()
         return self.metadata.get_str3ds_register()
 
 
     def set_stds_register(self, name):
     def set_stds_register(self, name):
-        """!Set the space time dataset register table name in 
+        """!Set the space time dataset register table name in
         which stds are listed in which this map is registered"""
         which stds are listed in which this map is registered"""
         self.metadata.set_str3ds_register(name)
         self.metadata.set_str3ds_register(name)
 
 
@@ -419,9 +419,9 @@ class Raster3DDataset(AbstractMapDataset):
             return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
             return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
 
 
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the three or two dimensional intersection as spatial_extent 
+        """!Return the three or two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent or None
            @return The intersection spatial extent or None
         """
         """
@@ -431,9 +431,9 @@ class Raster3DDataset(AbstractMapDataset):
             return self.spatial_extent.intersect_2d(dataset.spatial_extent)
             return self.spatial_extent.intersect_2d(dataset.spatial_extent)
 
 
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the three or two dimensional union as spatial_extent 
+        """!Return the three or two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent or None
            @return The union spatial extent or None
         """
         """
@@ -441,10 +441,10 @@ class Raster3DDataset(AbstractMapDataset):
             return self.spatial_extent.union(dataset.spatial_extent)
             return self.spatial_extent.union(dataset.spatial_extent)
         else:
         else:
             return self.spatial_extent.union_2d(dataset.spatial_extent)
             return self.spatial_extent.union_2d(dataset.spatial_extent)
-        
+
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the three or two dimensional union as spatial_extent object.
         """!Return the three or two dimensional union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
@@ -452,19 +452,19 @@ class Raster3DDataset(AbstractMapDataset):
             return self.spatial_extent.disjoint_union(dataset.spatial_extent)
             return self.spatial_extent.disjoint_union(dataset.spatial_extent)
         else:
         else:
             return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
             return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
-    
+
     def get_np_array(self):
     def get_np_array(self):
         """!Return this 3D raster map as memmap numpy style array to access the 3D raster
         """!Return this 3D raster map as memmap numpy style array to access the 3D raster
            values in numpy style without loading the whole map in the RAM.
            values in numpy style without loading the whole map in the RAM.
 
 
-           In case this 3D raster map does exists in the grass spatial database, 
-           the map will be exported using r3.out.bin to a temporary location 
+           In case this 3D raster map does exists in the grass spatial database,
+           the map will be exported using r3.out.bin to a temporary location
            and assigned to the memmap object that is returned by this function.
            and assigned to the memmap object that is returned by this function.
 
 
-           In case the 3D raster map does not exists, an empty temporary 
+           In case the 3D raster map does not exists, an empty temporary
            binary file will be created and assigned to the memap object.
            binary file will be created and assigned to the memap object.
 
 
-           You need to call the write function to write the memmap 
+           You need to call the write function to write the memmap
            array back into grass.
            array back into grass.
         """
         """
 
 
@@ -474,7 +474,7 @@ class Raster3DDataset(AbstractMapDataset):
             a.read(self.get_map_id())
             a.read(self.get_map_id())
 
 
         return a
         return a
-        
+
     def reset(self, ident):
     def reset(self, ident):
         """!Reset the internal structure and set the identifier"""
         """!Reset the internal structure and set the identifier"""
         self.base = Raster3DBase(ident=ident)
         self.base = Raster3DBase(ident=ident)
@@ -492,7 +492,7 @@ class Raster3DDataset(AbstractMapDataset):
             return False
             return False
 
 
     def write_timestamp_to_grass(self):
     def write_timestamp_to_grass(self):
-        """!Write the timestamp of this map into the map metadata 
+        """!Write the timestamp of this map into the map metadata
         in the grass file system based spatial database.
         in the grass file system based spatial database.
 
 
            Internally the libgis API functions are used for writing
            Internally the libgis API functions are used for writing
@@ -568,12 +568,12 @@ class Raster3DDataset(AbstractMapDataset):
         kvp["bottom"] = region.bottom
         kvp["bottom"] = region.bottom
 
 
         # We need to open the map, this function returns a void pointer
         # We need to open the map, this function returns a void pointer
-        # but we may need the correct type which is RASTER3D_Map, hence 
+        # but we may need the correct type which is RASTER3D_Map, hence
         # the casting
         # the casting
         g3map = cast(libraster3d.Rast3d_open_cell_old(name, mapset,
         g3map = cast(libraster3d.Rast3d_open_cell_old(name, mapset,
-                     libraster3d.RASTER3D_DEFAULT_WINDOW, 
+                     libraster3d.RASTER3D_DEFAULT_WINDOW,
                      libraster3d.RASTER3D_TILE_SAME_AS_FILE,
                      libraster3d.RASTER3D_TILE_SAME_AS_FILE,
-                     libraster3d.RASTER3D_NO_CACHE), 
+                     libraster3d.RASTER3D_NO_CACHE),
                      POINTER(libraster3d.RASTER3D_Map))
                      POINTER(libraster3d.RASTER3D_Map))
 
 
         if not g3map:
         if not g3map:
@@ -624,7 +624,7 @@ class Raster3DDataset(AbstractMapDataset):
         else:
         else:
             kvp = grass.raster3d_info(self.get_id())
             kvp = grass.raster3d_info(self.get_id())
 
 
-        self.set_spatial_extent(north=kvp["north"], south=kvp["south"],
+        self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
                                 east=kvp["east"], west=kvp["west"],
                                 east=kvp["east"], west=kvp["west"],
                                 top=kvp["top"], bottom=kvp["bottom"])
                                 top=kvp["top"], bottom=kvp["bottom"])
 
 
@@ -667,17 +667,17 @@ class VectorDataset(AbstractMapDataset):
         return VectorDataset(ident)
         return VectorDataset(ident)
 
 
     def get_new_stds_instance(self, ident):
     def get_new_stds_instance(self, ident):
-        """!Return a new space time dataset instance in which maps 
+        """!Return a new space time dataset instance in which maps
         are stored with the type of this class"""
         are stored with the type of this class"""
         return SpaceTimeVectorDataset(ident)
         return SpaceTimeVectorDataset(ident)
 
 
     def get_stds_register(self):
     def get_stds_register(self):
-        """!Return the space time dataset register table name in 
+        """!Return the space time dataset register table name in
         which stds are listed in which this map is registered"""
         which stds are listed in which this map is registered"""
         return self.metadata.get_stvds_register()
         return self.metadata.get_stvds_register()
 
 
     def set_stds_register(self, name):
     def set_stds_register(self, name):
-        """!Set the space time dataset register table name in 
+        """!Set the space time dataset register table name in
         which stds are listed in which this map is registered"""
         which stds are listed in which this map is registered"""
         self.metadata.set_stvds_register(name)
         self.metadata.set_stvds_register(name)
 
 
@@ -696,31 +696,31 @@ class VectorDataset(AbstractMapDataset):
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
 
 
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the two dimensional intersection as spatial_extent 
+        """!Return the two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent or None
            @return The intersection spatial extent or None
         """
         """
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
 
 
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the two dimensional union as spatial_extent 
+        """!Return the two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent or None
            @return The union spatial extent or None
         """
         """
         return self.spatial_extent.union_2d(dataset.spatial_extent)
         return self.spatial_extent.union_2d(dataset.spatial_extent)
-        
+
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the two dimensional union as spatial_extent object.
         """!Return the two dimensional union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
-        
+
     def reset(self, ident):
     def reset(self, ident):
         """!Reset the internal structure and set the identifier"""
         """!Reset the internal structure and set the identifier"""
         self.base = VectorBase(ident=ident)
         self.base = VectorBase(ident=ident)
@@ -732,14 +732,14 @@ class VectorDataset(AbstractMapDataset):
     def has_grass_timestamp(self):
     def has_grass_timestamp(self):
         """!Check if a grass file bsased time stamp exists for this map.
         """!Check if a grass file bsased time stamp exists for this map.
         """
         """
-        if G_has_vector_timestamp(self.get_name(), self.get_layer(), 
+        if G_has_vector_timestamp(self.get_name(), self.get_layer(),
                                   self.get_mapset()):
                                   self.get_mapset()):
             return True
             return True
         else:
         else:
             return False
             return False
 
 
     def write_timestamp_to_grass(self):
     def write_timestamp_to_grass(self):
-        """!Write the timestamp of this map into the map metadata in 
+        """!Write the timestamp of this map into the map metadata in
            the grass file system based spatial database.
            the grass file system based spatial database.
 
 
            Internally the libgis API functions are used for writing
            Internally the libgis API functions are used for writing
@@ -760,7 +760,7 @@ class VectorDataset(AbstractMapDataset):
                          (self.get_map_id())))
                          (self.get_map_id())))
 
 
     def remove_timestamp_from_grass(self):
     def remove_timestamp_from_grass(self):
-        """!Remove the timestamp from the grass file system based spatial 
+        """!Remove the timestamp from the grass file system based spatial
            database
            database
 
 
            Internally the libgis API functions are used for removal
            Internally the libgis API functions are used for removal
@@ -810,18 +810,18 @@ class VectorDataset(AbstractMapDataset):
         # Code lend from v.info main.c
         # Code lend from v.info main.c
         if libvector.Vect_open_old_head2(byref(Map), name, mapset, "1") < 2:
         if libvector.Vect_open_old_head2(byref(Map), name, mapset, "1") < 2:
             # force level 1, open fully
             # force level 1, open fully
-            # NOTE: number of points, lines, boundaries, centroids, 
+            # NOTE: number of points, lines, boundaries, centroids,
             # faces, kernels is still available
             # faces, kernels is still available
             libvector.Vect_set_open_level(1)  # no topology
             libvector.Vect_set_open_level(1)  # no topology
             with_topo = False
             with_topo = False
             core.message(_("Open map without topology support"))
             core.message(_("Open map without topology support"))
             if libvector.Vect_open_old2(byref(Map), name, mapset, "1") < 1:
             if libvector.Vect_open_old2(byref(Map), name, mapset, "1") < 1:
-                core.fatal(_("Unable to open vector map <%s>" % 
+                core.fatal(_("Unable to open vector map <%s>" %
                              (libvector.Vect_get_full_name(byref(Map)))))
                              (libvector.Vect_get_full_name(byref(Map)))))
 
 
         # Release the vector spatial index memory when closed
         # Release the vector spatial index memory when closed
         libvector.Vect_set_release_support(byref(Map))
         libvector.Vect_set_release_support(byref(Map))
-                             
+
         # Read the extent information
         # Read the extent information
         bbox = libvector.bound_box()
         bbox = libvector.bound_box()
         libvector.Vect_get_map_box(byref(Map), byref(bbox))
         libvector.Vect_get_map_box(byref(Map), byref(bbox))
@@ -882,7 +882,7 @@ class VectorDataset(AbstractMapDataset):
         return kvp
         return kvp
 
 
     def load(self):
     def load(self):
-        """!Load all info from an existing vector map into the internal 
+        """!Load all info from an existing vector map into the internal
         structure"""
         structure"""
 
 
         # Fill base information
         # Fill base information
@@ -896,7 +896,7 @@ class VectorDataset(AbstractMapDataset):
             kvp = grass.vector_info(self.get_map_id())
             kvp = grass.vector_info(self.get_map_id())
 
 
         # Fill spatial extent
         # Fill spatial extent
-        self.set_spatial_extent(north=kvp["north"], south=kvp["south"],
+        self.set_spatial_extent_from_values(north=kvp["north"], south=kvp["south"],
                                 east=kvp["east"], west=kvp["west"],
                                 east=kvp["east"], west=kvp["west"],
                                 top=kvp["top"], bottom=kvp["bottom"])
                                 top=kvp["top"], bottom=kvp["bottom"])
 
 
@@ -952,31 +952,31 @@ class SpaceTimeRasterDataset(AbstractSpaceTimeDataset):
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
 
 
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the two dimensional intersection as spatial_extent 
+        """!Return the two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent or None
            @return The intersection spatial extent or None
         """
         """
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
 
 
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the two dimensional union as spatial_extent 
+        """!Return the two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent or None
            @return The union spatial extent or None
         """
         """
         return self.spatial_extent.union_2d(dataset.spatial_extent)
         return self.spatial_extent.union_2d(dataset.spatial_extent)
-        
+
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the two dimensional union as spatial_extent object.
         """!Return the two dimensional union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
-    
+
     def reset(self, ident):
     def reset(self, ident):
 
 
         """!Reset the internal structure and set the identifier"""
         """!Reset the internal structure and set the identifier"""
@@ -1004,7 +1004,7 @@ class SpaceTimeRaster3DDataset(AbstractSpaceTimeDataset):
         return SpaceTimeRaster3DDataset(ident)
         return SpaceTimeRaster3DDataset(ident)
 
 
     def get_new_map_instance(self, ident):
     def get_new_map_instance(self, ident):
-        """!Return a new instance of a map dataset which is associated 
+        """!Return a new instance of a map dataset which is associated
         with the type of this class"""
         with the type of this class"""
         return Raster3DDataset(ident)
         return Raster3DDataset(ident)
 
 
@@ -1034,9 +1034,9 @@ class SpaceTimeRaster3DDataset(AbstractSpaceTimeDataset):
             return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
             return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
 
 
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the three or two dimensional intersection as spatial_extent 
+        """!Return the three or two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent or None
            @return The intersection spatial extent or None
         """
         """
@@ -1046,9 +1046,9 @@ class SpaceTimeRaster3DDataset(AbstractSpaceTimeDataset):
             return self.spatial_extent.intersect_2d(dataset.spatial_extent)
             return self.spatial_extent.intersect_2d(dataset.spatial_extent)
 
 
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the three or two dimensional union as spatial_extent 
+        """!Return the three or two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent or None
            @return The union spatial extent or None
         """
         """
@@ -1056,10 +1056,10 @@ class SpaceTimeRaster3DDataset(AbstractSpaceTimeDataset):
             return self.spatial_extent.union(dataset.spatial_extent)
             return self.spatial_extent.union(dataset.spatial_extent)
         else:
         else:
             return self.spatial_extent.union_2d(dataset.spatial_extent)
             return self.spatial_extent.union_2d(dataset.spatial_extent)
-        
+
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the three or two dimensional union as spatial_extent object.
         """!Return the three or two dimensional union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
@@ -1067,7 +1067,7 @@ class SpaceTimeRaster3DDataset(AbstractSpaceTimeDataset):
             return self.spatial_extent.disjoint_union(dataset.spatial_extent)
             return self.spatial_extent.disjoint_union(dataset.spatial_extent)
         else:
         else:
             return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
             return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
-    
+
     def reset(self, ident):
     def reset(self, ident):
 
 
         """!Reset the internal structure and set the identifier"""
         """!Reset the internal structure and set the identifier"""
@@ -1096,7 +1096,7 @@ class SpaceTimeVectorDataset(AbstractSpaceTimeDataset):
         return SpaceTimeVectorDataset(ident)
         return SpaceTimeVectorDataset(ident)
 
 
     def get_new_map_instance(self, ident):
     def get_new_map_instance(self, ident):
-        """!Return a new instance of a map dataset which is associated 
+        """!Return a new instance of a map dataset which is associated
         with the type of this class"""
         with the type of this class"""
         return VectorDataset(ident)
         return VectorDataset(ident)
 
 
@@ -1117,31 +1117,31 @@ class SpaceTimeVectorDataset(AbstractSpaceTimeDataset):
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
         return self.spatial_extent.spatial_relation_2d(dataset.spatial_extent)
 
 
     def spatial_intersection(self, dataset):
     def spatial_intersection(self, dataset):
-        """!Return the two dimensional intersection as spatial_extent 
+        """!Return the two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-           
+
            @param dataset The abstract dataset to intersect with
            @param dataset The abstract dataset to intersect with
            @return The intersection spatial extent or None
            @return The intersection spatial extent or None
         """
         """
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
         return self.spatial_extent.intersect_2d(dataset.spatial_extent)
 
 
     def spatial_union(self, dataset):
     def spatial_union(self, dataset):
-        """!Return the two dimensional union as spatial_extent 
+        """!Return the two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent or None
            @return The union spatial extent or None
         """
         """
         return self.spatial_extent.union_2d(dataset.spatial_extent)
         return self.spatial_extent.union_2d(dataset.spatial_extent)
-        
+
     def spatial_disjoint_union(self, dataset):
     def spatial_disjoint_union(self, dataset):
         """!Return the two dimensional union as spatial_extent object.
         """!Return the two dimensional union as spatial_extent object.
-       
+
            @param dataset The abstract dataset to create a union with
            @param dataset The abstract dataset to create a union with
            @return The union spatial extent
            @return The union spatial extent
         """
         """
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
         return self.spatial_extent.disjoint_union_2d(dataset.spatial_extent)
-    
+
     def reset(self, ident):
     def reset(self, ident):
 
 
         """!Reset the internal structure and set the identifier"""
         """!Reset the internal structure and set the identifier"""

+ 192 - 157
lib/python/temporal/spatial_extent.py

@@ -10,22 +10,22 @@ Usage:
 
 
 >>> import grass.temporal as tgis
 >>> import grass.temporal as tgis
 >>> tgis.init()
 >>> tgis.init()
->>> extent = tgis.RasterSpatialExtent( 
+>>> extent = tgis.RasterSpatialExtent(
 ... ident="raster@PERMANENT", north=90, south=90, east=180, west=180,
 ... ident="raster@PERMANENT", north=90, south=90, east=180, west=180,
 ... top=100, bottom=-20)
 ... top=100, bottom=-20)
->>> extent = tgis.Raster3DSpatialExtent( 
+>>> extent = tgis.Raster3DSpatialExtent(
 ... ident="raster3d@PERMANENT", north=90, south=90, east=180, west=180,
 ... ident="raster3d@PERMANENT", north=90, south=90, east=180, west=180,
 ... top=100, bottom=-20)
 ... top=100, bottom=-20)
->>> extent = tgis.VectorSpatialExtent( 
+>>> extent = tgis.VectorSpatialExtent(
 ... ident="vector@PERMANENT", north=90, south=90, east=180, west=180,
 ... ident="vector@PERMANENT", north=90, south=90, east=180, west=180,
 ... top=100, bottom=-20)
 ... top=100, bottom=-20)
->>> extent = tgis.STRDSSpatialExtent( 
+>>> extent = tgis.STRDSSpatialExtent(
 ... ident="strds@PERMANENT", north=90, south=90, east=180, west=180,
 ... ident="strds@PERMANENT", north=90, south=90, east=180, west=180,
 ... top=100, bottom=-20)
 ... top=100, bottom=-20)
->>> extent = tgis.STR3DSSpatialExtent( 
+>>> extent = tgis.STR3DSSpatialExtent(
 ... ident="str3ds@PERMANENT", north=90, south=90, east=180, west=180,
 ... ident="str3ds@PERMANENT", north=90, south=90, east=180, west=180,
 ... top=100, bottom=-20)
 ... top=100, bottom=-20)
->>> extent = tgis.STVDSSpatialExtent( 
+>>> extent = tgis.STVDSSpatialExtent(
 ... ident="stvds@PERMANENT", north=90, south=90, east=180, west=180,
 ... ident="stvds@PERMANENT", north=90, south=90, east=180, west=180,
 ... top=100, bottom=-20)
 ... top=100, bottom=-20)
 
 
@@ -43,16 +43,16 @@ from base import *
 
 
 class SpatialExtent(SQLDatabaseInterface):
 class SpatialExtent(SQLDatabaseInterface):
     """!This is the spatial extent base class for all maps and space time datasets
     """!This is the spatial extent base class for all maps and space time datasets
-        
+
         This class implements a three dimensional axis aligned bounding box
         This class implements a three dimensional axis aligned bounding box
         and functions to compute topological relationships
         and functions to compute topological relationships
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
+
         >>> init()
         >>> init()
-        >>> extent = SpatialExtent(table="raster_spatial_extent", 
+        >>> extent = SpatialExtent(table="raster_spatial_extent",
         ... ident="soil@PERMANENT", north=90, south=90, east=180, west=180,
         ... ident="soil@PERMANENT", north=90, south=90, east=180, west=180,
         ... top=100, bottom=-20)
         ... top=100, bottom=-20)
         >>> extent.id
         >>> extent.id
@@ -84,39 +84,39 @@ class SpatialExtent(SQLDatabaseInterface):
         west=180.0
         west=180.0
         top=100.0
         top=100.0
         bottom=-20.0
         bottom=-20.0
-        
+
         @endcode
         @endcode
     """
     """
-    def __init__(self, table=None, ident=None, north=None, south=None, 
+    def __init__(self, table=None, ident=None, north=None, south=None,
                  east=None, west=None, top=None, bottom=None, proj="XY"):
                  east=None, west=None, top=None, bottom=None, proj="XY"):
 
 
         SQLDatabaseInterface.__init__(self, table, ident)
         SQLDatabaseInterface.__init__(self, table, ident)
         self.set_id(ident)
         self.set_id(ident)
-        self.set_spatial_extent(north, south, east, west, top, bottom)
+        self.set_spatial_extent_from_values(north, south, east, west, top, bottom)
         self.set_projection(proj)
         self.set_projection(proj)
 
 
     def overlapping_2d(self, extent):
     def overlapping_2d(self, extent):
         """!Return True if this (A) and the provided spatial extent (B) overlaps
         """!Return True if this (A) and the provided spatial extent (B) overlaps
-        in two dimensional space. 
+        in two dimensional space.
         Code is lend from wind_overlap.c in lib/gis
         Code is lend from wind_overlap.c in lib/gis
-        
+
         Overlapping includes the spatial relations:
         Overlapping includes the spatial relations:
-        
+
         - contain
         - contain
         - in
         - in
         - cover
         - cover
         - covered
         - covered
         - equivalent
         - equivalent
-        
+
          @code
          @code
-         
+
          >>> A = SpatialExtent(north=80, south=20, east=60, west=10)
          >>> A = SpatialExtent(north=80, south=20, east=60, west=10)
          >>> B = SpatialExtent(north=80, south=20, east=60, west=10)
          >>> B = SpatialExtent(north=80, south=20, east=60, west=10)
          >>> A.overlapping_2d(B)
          >>> A.overlapping_2d(B)
          True
          True
-         
+
          @endcode
          @endcode
-        
+
         @param extent The spatial extent to check overlapping with
         @param extent The spatial extent to check overlapping with
         @return True or False
         @return True or False
         """
         """
@@ -156,28 +156,28 @@ class SpatialExtent(SQLDatabaseInterface):
         return True
         return True
 
 
     def overlapping(self, extent):
     def overlapping(self, extent):
-        """!Return True if this (A) and the provided spatial 
+        """!Return True if this (A) and the provided spatial
         extent (B) overlaps in three dimensional space.
         extent (B) overlaps in three dimensional space.
-        
+
         Overlapping includes the spatial relations:
         Overlapping includes the spatial relations:
-        
+
         - contain
         - contain
         - in
         - in
         - cover
         - cover
         - covered
         - covered
         - equivalent
         - equivalent
-            
+
          Usage:
          Usage:
-         
+
          @code
          @code
-         
+
          >>> A = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
          >>> A = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
          >>> B = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
          >>> B = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
          >>> A.overlapping(B)
          >>> A.overlapping(B)
          True
          True
-         
+
          @endcode
          @endcode
-         
+
          @param extent The spatial extent to check overlapping with
          @param extent The spatial extent to check overlapping with
          @return True or False
          @return True or False
         """
         """
@@ -197,9 +197,9 @@ class SpatialExtent(SQLDatabaseInterface):
         return True
         return True
 
 
     def intersect_2d(self, extent):
     def intersect_2d(self, extent):
-        """!Return the two dimensional intersection as spatial_extent 
+        """!Return the two dimensional intersection as spatial_extent
            object or None in case no intersection was found.
            object or None in case no intersection was found.
-       
+
         @param extent The spatial extent to intersect with
         @param extent The spatial extent to intersect with
         @return The intersection spatial extent
         @return The intersection spatial extent
         """
         """
@@ -247,16 +247,16 @@ class SpatialExtent(SQLDatabaseInterface):
         return new
         return new
 
 
     def intersect(self, extent):
     def intersect(self, extent):
-        """!Return the three dimensional intersection as spatial_extent 
+        """!Return the three dimensional intersection as spatial_extent
         object or None in case no intersection was found.
         object or None in case no intersection was found.
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
-        >>> A = SpatialExtent(north=80, south=20, east=60, west=10, 
+
+        >>> A = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
-        >>> B = SpatialExtent(north=80, south=20, east=60, west=10, 
+        >>> B = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> C = A.intersect(B)
         >>> C = A.intersect(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -267,7 +267,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=10, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> C = A.intersect(B)
         >>> C = A.intersect(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -278,7 +278,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=30, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=30,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> C = A.intersect(B)
         >>> C = A.intersect(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -289,7 +289,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 30.0
          | West:....................... 30.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=30, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=30,
         ... bottom=-30, top=50)
         ... bottom=-30, top=50)
         >>> C = A.intersect(B)
         >>> C = A.intersect(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -300,7 +300,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 30.0
          | West:....................... 30.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -30.0
          | Bottom:..................... -30.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=30, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=30,
         ... bottom=-30, top=30)
         ... bottom=-30, top=30)
         >>> C = A.intersect(B)
         >>> C = A.intersect(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -311,10 +311,10 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 30.0
          | West:....................... 30.0
          | Top:........................ 30.0
          | Top:........................ 30.0
          | Bottom:..................... -30.0
          | Bottom:..................... -30.0
-         
+
          @endcode
          @endcode
-         
-         
+
+
          @param extent The spatial extent to intersect with
          @param extent The spatial extent to intersect with
          @return The intersection spatial extent
          @return The intersection spatial extent
         """
         """
@@ -342,22 +342,22 @@ class SpatialExtent(SQLDatabaseInterface):
         new.set_bottom(nB)
         new.set_bottom(nB)
 
 
         return new
         return new
-        
+
     def union_2d(self, extent):
     def union_2d(self, extent):
-        """!Return the two dimensional union as spatial_extent 
+        """!Return the two dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
         @param extent The spatial extent to create a union with
         @param extent The spatial extent to create a union with
         @return The union spatial extent
         @return The union spatial extent
         """
         """
         if not self.overlapping_2d(extent) and not self.meet_2d(extent):
         if not self.overlapping_2d(extent) and not self.meet_2d(extent):
             return None
             return None
-        
+
         return self.disjoint_union_2d(extent)
         return self.disjoint_union_2d(extent)
-    
+
     def disjoint_union_2d(self, extent):
     def disjoint_union_2d(self, extent):
         """!Return the two dimensional union as spatial_extent.
         """!Return the two dimensional union as spatial_extent.
-       
+
         @param extent The spatial extent to create a union with
         @param extent The spatial extent to create a union with
         @return The union spatial extent
         @return The union spatial extent
         """
         """
@@ -401,27 +401,27 @@ class SpatialExtent(SQLDatabaseInterface):
         return new
         return new
 
 
     def union(self, extent):
     def union(self, extent):
-        """!Return the three dimensional union as spatial_extent 
+        """!Return the three dimensional union as spatial_extent
            object or None in case the extents does not overlap or meet.
            object or None in case the extents does not overlap or meet.
-       
+
         @param extent The spatial extent to create a union with
         @param extent The spatial extent to create a union with
         @return The union spatial extent
         @return The union spatial extent
         """
         """
         if not self.overlapping(extent) and not self.meet(extent):
         if not self.overlapping(extent) and not self.meet(extent):
             return None
             return None
-        
+
         return self.disjoint_union(extent)
         return self.disjoint_union(extent)
-    
+
     def disjoint_union(self, extent):
     def disjoint_union(self, extent):
         """!Return the three dimensional union as spatial_extent .
         """!Return the three dimensional union as spatial_extent .
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
-        >>> A = SpatialExtent(north=80, south=20, east=60, west=10, 
+
+        >>> A = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
-        >>> B = SpatialExtent(north=80, south=20, east=60, west=10, 
+        >>> B = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> C = A.disjoint_union(B)
         >>> C = A.disjoint_union(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -432,7 +432,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=10, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> C = A.disjoint_union(B)
         >>> C = A.disjoint_union(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -443,7 +443,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=30, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=30,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> C = A.disjoint_union(B)
         >>> C = A.disjoint_union(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -454,7 +454,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=30, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=30,
         ... bottom=-30, top=50)
         ... bottom=-30, top=50)
         >>> C = A.disjoint_union(B)
         >>> C = A.disjoint_union(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -465,7 +465,7 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> B = SpatialExtent(north=40, south=30, east=60, west=30, 
+        >>> B = SpatialExtent(north=40, south=30, east=60, west=30,
         ... bottom=-30, top=30)
         ... bottom=-30, top=30)
         >>> C = A.disjoint_union(B)
         >>> C = A.disjoint_union(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -476,9 +476,9 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 50.0
          | Top:........................ 50.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-        >>> A = SpatialExtent(north=80, south=20, east=60, west=10, 
+        >>> A = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
-        >>> B = SpatialExtent(north=90, south=80, east=70, west=20, 
+        >>> B = SpatialExtent(north=90, south=80, east=70, west=20,
         ... bottom=-30, top=60)
         ... bottom=-30, top=60)
         >>> C = A.disjoint_union(B)
         >>> C = A.disjoint_union(B)
         >>> C.print_info()
         >>> C.print_info()
@@ -489,9 +489,9 @@ class SpatialExtent(SQLDatabaseInterface):
          | West:....................... 10.0
          | West:....................... 10.0
          | Top:........................ 60.0
          | Top:........................ 60.0
          | Bottom:..................... -50.0
          | Bottom:..................... -50.0
-         
+
          @endcode
          @endcode
-         
+
          @param extent The spatial extent to create a disjoint union with
          @param extent The spatial extent to create a disjoint union with
          @return The union spatial extent
          @return The union spatial extent
         """
         """
@@ -516,19 +516,19 @@ class SpatialExtent(SQLDatabaseInterface):
         new.set_bottom(nB)
         new.set_bottom(nB)
 
 
         return new
         return new
-    
+
     def is_in_2d(self, extent):
     def is_in_2d(self, extent):
         """!Return True if this extent (A) is located in the provided spatial
         """!Return True if this extent (A) is located in the provided spatial
         extent (B) in two dimensions.
         extent (B) in two dimensions.
-        
+
         @verbatim
         @verbatim
          _____
          _____
         |A _  |
         |A _  |
         | |_| |
         | |_| |
-        |_____|B 
-        
+        |_____|B
+
         @endverbatim
         @endverbatim
-        
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -571,22 +571,22 @@ class SpatialExtent(SQLDatabaseInterface):
     def is_in(self, extent):
     def is_in(self, extent):
         """!Return True if this extent (A) is located in the provided spatial
         """!Return True if this extent (A) is located in the provided spatial
         extent (B) in three dimensions.
         extent (B) in three dimensions.
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
-        >>> A = SpatialExtent(north=79, south=21, east=59, west=11, 
+
+        >>> A = SpatialExtent(north=79, south=21, east=59, west=11,
         ... bottom=-49, top=49)
         ... bottom=-49, top=49)
-        >>> B = SpatialExtent(north=80, south=20, east=60, west=10, 
+        >>> B = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> A.is_in(B)
         >>> A.is_in(B)
         True
         True
         >>> B.is_in(A)
         >>> B.is_in(A)
         False
         False
-        
+
         @endcode
         @endcode
-        
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -609,44 +609,44 @@ class SpatialExtent(SQLDatabaseInterface):
     def contain_2d(self, extent):
     def contain_2d(self, extent):
         """!Return True if this extent (A) contains the provided spatial
         """!Return True if this extent (A) contains the provided spatial
         extent (B) in two dimensions.
         extent (B) in two dimensions.
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
+
         >>> A = SpatialExtent(north=80, south=20, east=60, west=10)
         >>> A = SpatialExtent(north=80, south=20, east=60, west=10)
         >>> B = SpatialExtent(north=79, south=21, east=59, west=11)
         >>> B = SpatialExtent(north=79, south=21, east=59, west=11)
         >>> A.contain_2d(B)
         >>> A.contain_2d(B)
         True
         True
         >>> B.contain_2d(A)
         >>> B.contain_2d(A)
         False
         False
-        
+
         @endcode
         @endcode
-        
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
         return extent.is_in_2d(self)
         return extent.is_in_2d(self)
 
 
-    def contain(self, extent):        
+    def contain(self, extent):
         """!Return True if this extent (A) contains the provided spatial
         """!Return True if this extent (A) contains the provided spatial
         extent (B) in three dimensions.
         extent (B) in three dimensions.
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
-        >>> A = SpatialExtent(north=80, south=20, east=60, west=10, 
+
+        >>> A = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
-        >>> B = SpatialExtent(north=79, south=21, east=59, west=11, 
+        >>> B = SpatialExtent(north=79, south=21, east=59, west=11,
         ... bottom=-49, top=49)
         ... bottom=-49, top=49)
         >>> A.contain(B)
         >>> A.contain(B)
         True
         True
         >>> B.contain(A)
         >>> B.contain(A)
         False
         False
-        
+
         @endcode
         @endcode
-        
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -655,20 +655,20 @@ class SpatialExtent(SQLDatabaseInterface):
     def equivalent_2d(self, extent):
     def equivalent_2d(self, extent):
         """!Return True if this extent (A) is equal to the provided spatial
         """!Return True if this extent (A) is equal to the provided spatial
         extent (B) in two dimensions.
         extent (B) in two dimensions.
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
+
         >>> A = SpatialExtent(north=80, south=20, east=60, west=10)
         >>> A = SpatialExtent(north=80, south=20, east=60, west=10)
         >>> B = SpatialExtent(north=80, south=20, east=60, west=10)
         >>> B = SpatialExtent(north=80, south=20, east=60, west=10)
         >>> A.equivalent_2d(B)
         >>> A.equivalent_2d(B)
         True
         True
         >>> B.equivalent_2d(A)
         >>> B.equivalent_2d(A)
         True
         True
-        
+
         @endcode
         @endcode
-        
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -711,22 +711,22 @@ class SpatialExtent(SQLDatabaseInterface):
     def equivalent(self, extent):
     def equivalent(self, extent):
         """!Return True if this extent (A) is equal to the provided spatial
         """!Return True if this extent (A) is equal to the provided spatial
         extent (B) in three dimensions.
         extent (B) in three dimensions.
-        
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
-        >>> A = SpatialExtent(north=80, south=20, east=60, west=10, 
+
+        >>> A = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
-        >>> B = SpatialExtent(north=80, south=20, east=60, west=10, 
+        >>> B = SpatialExtent(north=80, south=20, east=60, west=10,
         ... bottom=-50, top=50)
         ... bottom=-50, top=50)
         >>> A.equivalent(B)
         >>> A.equivalent(B)
         True
         True
         >>> B.equivalent(A)
         >>> B.equivalent(A)
         True
         True
-        
+
         @endcode
         @endcode
-        
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -750,27 +750,27 @@ class SpatialExtent(SQLDatabaseInterface):
     def cover_2d(self, extent):
     def cover_2d(self, extent):
         """!Return True if this extent (A) covers the provided spatial
         """!Return True if this extent (A) covers the provided spatial
         extent (B) in two dimensions.
         extent (B) in two dimensions.
-           
+
         @verbatim
         @verbatim
          _____    _____    _____    _____
          _____    _____    _____    _____
         |A  __|  |__  A|  |A | B|  |B | A|
         |A  __|  |__  A|  |A | B|  |B | A|
         |  |B |  | B|  |  |  |__|  |__|  |
         |  |B |  | B|  |  |  |__|  |__|  |
         |__|__|  |__|__|  |_____|  |_____|
         |__|__|  |__|__|  |_____|  |_____|
-        
+
          _____    _____    _____    _____
          _____    _____    _____    _____
         |A|B| |  |A  __|  |A _  |  |__  A|
         |A|B| |  |A  __|  |A _  |  |__  A|
         | |_| |  |  |__|B | |B| | B|__|  |
         | |_| |  |  |__|B | |B| | B|__|  |
         |_____|  |_____|  |_|_|_|  |_____|
         |_____|  |_____|  |_|_|_|  |_____|
-        
+
          _____    _____    _____    _____
          _____    _____    _____    _____
         |A|B  |  |_____|A |A|B|A|  |_____|A
         |A|B  |  |_____|A |A|B|A|  |_____|A
         | |   |  |B    |  | | | |  |_____|B
         | |   |  |B    |  | | | |  |_____|B
         |_|___|  |_____|  |_|_|_|  |_____|A
         |_|___|  |_____|  |_|_|_|  |_____|A
-        
+
         @endverbatim
         @endverbatim
-        
+
         The following cases are excluded:
         The following cases are excluded:
-        
+
         - contain
         - contain
         - in
         - in
         - equivalent
         - equivalent
@@ -840,9 +840,9 @@ class SpatialExtent(SQLDatabaseInterface):
     def cover(self, extent):
     def cover(self, extent):
         """!Return True if this extent covers the provided spatial
         """!Return True if this extent covers the provided spatial
         extent in three dimensions.
         extent in three dimensions.
-        
+
         The following cases are excluded:
         The following cases are excluded:
-        
+
         - contain
         - contain
         - in
         - in
         - equivalent
         - equivalent
@@ -930,9 +930,9 @@ class SpatialExtent(SQLDatabaseInterface):
     def covered_2d(self, extent):
     def covered_2d(self, extent):
         """!Return True if this extent is covered by the provided spatial
         """!Return True if this extent is covered by the provided spatial
         extent in two dimensions.
         extent in two dimensions.
-        
+
         The following cases are excluded:
         The following cases are excluded:
-        
+
         - contain
         - contain
         - in
         - in
         - equivalent
         - equivalent
@@ -946,9 +946,9 @@ class SpatialExtent(SQLDatabaseInterface):
     def covered(self, extent):
     def covered(self, extent):
         """!Return True if this extent is covered by the provided spatial
         """!Return True if this extent is covered by the provided spatial
         extent in three dimensions.
         extent in three dimensions.
-        
+
         The following cases are excluded:
         The following cases are excluded:
-        
+
         - contain
         - contain
         - in
         - in
         - equivalent
         - equivalent
@@ -963,24 +963,24 @@ class SpatialExtent(SQLDatabaseInterface):
         """!Return True if this extent (A) overlaps with the provided spatial
         """!Return True if this extent (A) overlaps with the provided spatial
         extent (B) in two dimensions.
         extent (B) in two dimensions.
         Code is lend from wind_overlap.c in lib/gis
         Code is lend from wind_overlap.c in lib/gis
-        
+
         @verbatim
         @verbatim
          _____
          _____
         |A  __|__
         |A  __|__
         |  |  | B|
         |  |  | B|
         |__|__|  |
         |__|__|  |
            |_____|
            |_____|
-           
+
         @endverbatim
         @endverbatim
-        
+
         The following cases are excluded:
         The following cases are excluded:
-        
+
         - contain
         - contain
         - in
         - in
         - cover
         - cover
         - covered
         - covered
         - equivalent
         - equivalent
-           
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -1034,13 +1034,13 @@ class SpatialExtent(SQLDatabaseInterface):
         extent in three dimensions.
         extent in three dimensions.
 
 
         The following cases are excluded:
         The following cases are excluded:
-        
+
         - contain
         - contain
         - in
         - in
         - cover
         - cover
         - covered
         - covered
         - equivalent
         - equivalent
-           
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -1100,9 +1100,9 @@ class SpatialExtent(SQLDatabaseInterface):
     def meet_2d(self, extent):
     def meet_2d(self, extent):
         """!Return True if this extent (A) meets with the provided spatial
         """!Return True if this extent (A) meets with the provided spatial
         extent (B) in two dimensions.
         extent (B) in two dimensions.
-        
+
         @verbatim
         @verbatim
-          _____ _____ 
+          _____ _____
          |  A  |  B  |
          |  A  |  B  |
          |_____|     |
          |_____|     |
                |_____|
                |_____|
@@ -1113,10 +1113,10 @@ class SpatialExtent(SQLDatabaseInterface):
            ___
            ___
           | A |
           | A |
           |   |
           |   |
-          |___| 
+          |___|
          |  B  |
          |  B  |
-         |     |  
-         |_____|  
+         |     |
+         |_____|
           _____
           _____
          |  B  |
          |  B  |
          |     |
          |     |
@@ -1124,9 +1124,9 @@ class SpatialExtent(SQLDatabaseInterface):
            |  A  |
            |  A  |
            |     |
            |     |
            |_____|
            |_____|
-             
+
          @endverbatim
          @endverbatim
-           
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -1136,9 +1136,6 @@ class SpatialExtent(SQLDatabaseInterface):
         eE = extent.get_east()
         eE = extent.get_east()
         eW = extent.get_west()
         eW = extent.get_west()
 
 
-        eT = extent.get_top()
-        eB = extent.get_bottom()
-
         N = self.get_north()
         N = self.get_north()
         S = self.get_south()
         S = self.get_south()
         E = self.get_east()
         E = self.get_east()
@@ -1188,7 +1185,7 @@ class SpatialExtent(SQLDatabaseInterface):
     def meet(self, extent):
     def meet(self, extent):
         """!Return True if this extent meets with the provided spatial
         """!Return True if this extent meets with the provided spatial
         extent in three dimensions.
         extent in three dimensions.
-           
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -1309,7 +1306,7 @@ class SpatialExtent(SQLDatabaseInterface):
     def disjoint(self, extent):
     def disjoint(self, extent):
         """!Return True if this extent is disjoint with the provided spatial
         """!Return True if this extent is disjoint with the provided spatial
         extent in three dimensions.
         extent in three dimensions.
-           
+
         @param extent The spatial extent
         @param extent The spatial extent
         @return True or False
         @return True or False
         """
         """
@@ -1334,7 +1331,7 @@ class SpatialExtent(SQLDatabaseInterface):
 
 
         if  self.meet(extent):
         if  self.meet(extent):
             return False
             return False
-            
+
         return True
         return True
 
 
     def spatial_relation_2d(self, extent):
     def spatial_relation_2d(self, extent):
@@ -1342,7 +1339,7 @@ class SpatialExtent(SQLDatabaseInterface):
         extent and the provided spatial extent in two dimensions.
         extent and the provided spatial extent in two dimensions.
 
 
         Spatial relations are:
         Spatial relations are:
-        
+
         - disjoint
         - disjoint
         - meet
         - meet
         - overlap
         - overlap
@@ -1351,7 +1348,7 @@ class SpatialExtent(SQLDatabaseInterface):
         - in
         - in
         - contain
         - contain
         - equivalent
         - equivalent
-        
+
         Usage: see self.spatial_relation()
         Usage: see self.spatial_relation()
         """
         """
 
 
@@ -1379,7 +1376,7 @@ class SpatialExtent(SQLDatabaseInterface):
         extent and the provided spatial extent in three dimensions.
         extent and the provided spatial extent in three dimensions.
 
 
         Spatial relations are:
         Spatial relations are:
-        
+
         - disjoint
         - disjoint
         - meet
         - meet
         - overlap
         - overlap
@@ -1388,12 +1385,12 @@ class SpatialExtent(SQLDatabaseInterface):
         - in
         - in
         - contain
         - contain
         - equivalent
         - equivalent
-            
-        
+
+
         Usage:
         Usage:
-        
+
         @code
         @code
-        
+
         >>> A = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
         >>> A = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
         >>> B = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
         >>> B = SpatialExtent(north=80, south=20, east=60, west=10, bottom=-50, top=50)
         >>> A.spatial_relation(B)
         >>> A.spatial_relation(B)
@@ -1551,7 +1548,7 @@ class SpatialExtent(SQLDatabaseInterface):
         >>> B = SpatialExtent(north=90, south=80, east=60, west=10, bottom=-50, top=50)
         >>> B = SpatialExtent(north=90, south=80, east=60, west=10, bottom=-50, top=50)
         >>> A.spatial_relation(B)
         >>> A.spatial_relation(B)
         'meet'
         'meet'
-        
+
         @endcode
         @endcode
         """
         """
 
 
@@ -1574,8 +1571,16 @@ class SpatialExtent(SQLDatabaseInterface):
 
 
         return "unknown"
         return "unknown"
 
 
-    def set_spatial_extent(self, north, south, east, west, top, bottom):
-        """!Set the three dimensional spatial extent"""
+    def set_spatial_extent_from_values(self, north, south, east, west, top, bottom):
+        """!Set the three dimensional spatial extent
+
+           @param north The northern edge
+           @param south The southern edge
+           @param east The eastern edge
+           @param west The western edge
+           @param top The top edge
+           @param bottom The bottom edge
+        """
 
 
         self.set_north(north)
         self.set_north(north)
         self.set_south(south)
         self.set_south(south)
@@ -1584,6 +1589,19 @@ class SpatialExtent(SQLDatabaseInterface):
         self.set_top(top)
         self.set_top(top)
         self.set_bottom(bottom)
         self.set_bottom(bottom)
 
 
+    def set_spatial_extent(self, spatial_extent):
+        """!Set the three dimensional spatial extent
+
+            @param spatial_extent An object of type SpatialExtent or its subclasses
+        """
+
+        self.set_north(spatial_extent.get_north())
+        self.set_south(spatial_extent.get_south())
+        self.set_east(spatial_extent.get_east())
+        self.set_west(spatial_extent.get_west())
+        self.set_top(spatial_extent.get_top())
+        self.set_bottom(spatial_extent.get_bottom())
+
     def set_projection(self, proj):
     def set_projection(self, proj):
         """!Set the projection of the spatial extent it should be XY or LL.
         """!Set the projection of the spatial extent it should be XY or LL.
            As default the projection is XY
            As default the projection is XY
@@ -1593,14 +1611,31 @@ class SpatialExtent(SQLDatabaseInterface):
         else:
         else:
             self.D["proj"] = proj
             self.D["proj"] = proj
 
 
-    def set_spatial_extent_2d(self, north, south, east, west):
-        """!Set the two dimensional spatial extent"""
+    def set_spatial_extent_from_values_2d(self, north, south, east, west):
+        """!Set the two dimensional spatial extent from values
+
+           @param north The northern edge
+           @param south The southern edge
+           @param east The eastern edge
+           @param west The western edge
+        """
 
 
         self.set_north(north)
         self.set_north(north)
         self.set_south(south)
         self.set_south(south)
         self.set_east(east)
         self.set_east(east)
         self.set_west(west)
         self.set_west(west)
 
 
+    def set_spatial_extent_2d(self, spatial_extent):
+        """!Set the three dimensional spatial extent
+
+            @param spatial_extent An object of type SpatialExtent or its subclasses
+        """
+
+        self.set_north(spatial_extent.north)
+        self.set_south(spatial_extent.south)
+        self.set_east(spatial_extent.east)
+        self.set_west(spatial_extent.west)
+
     def set_id(self, ident):
     def set_id(self, ident):
         """!Convenient method to set the unique identifier (primary key)"""
         """!Convenient method to set the unique identifier (primary key)"""
         self.ident = ident
         self.ident = ident
@@ -1662,7 +1697,7 @@ class SpatialExtent(SQLDatabaseInterface):
         return self.D["proj"]
         return self.D["proj"]
 
 
     def get_volume(self):
     def get_volume(self):
-        """!Compute the volume of the extent, in case z is zero 
+        """!Compute the volume of the extent, in case z is zero
            (top == bottom or top - bottom = 1) the area is returned"""
            (top == bottom or top - bottom = 1) the area is returned"""
 
 
         if self.get_projection() == "LL":
         if self.get_projection() == "LL":
@@ -1695,7 +1730,7 @@ class SpatialExtent(SQLDatabaseInterface):
         return x * y
         return x * y
 
 
     def get_spatial_extent_as_tuple(self):
     def get_spatial_extent_as_tuple(self):
-        """!Return a tuple (north, south, east, west, top, bottom) 
+        """!Return a tuple (north, south, east, west, top, bottom)
            of the spatial extent"""
            of the spatial extent"""
 
 
         return (
         return (
@@ -1754,7 +1789,7 @@ class SpatialExtent(SQLDatabaseInterface):
             return self.D["bottom"]
             return self.D["bottom"]
         else:
         else:
             return None
             return None
-    
+
     id = property(fget=get_id, fset=set_id)
     id = property(fget=get_id, fset=set_id)
     north = property(fget=get_north, fset=set_north)
     north = property(fget=get_north, fset=set_north)
     south = property(fget=get_south, fset=set_south)
     south = property(fget=get_south, fset=set_south)
@@ -1787,37 +1822,37 @@ class SpatialExtent(SQLDatabaseInterface):
 ###############################################################################
 ###############################################################################
 
 
 class RasterSpatialExtent(SpatialExtent):
 class RasterSpatialExtent(SpatialExtent):
-    def __init__(self, ident=None, north=None, south=None, east=None, 
+    def __init__(self, ident=None, north=None, south=None, east=None,
                  west=None, top=None, bottom=None):
                  west=None, top=None, bottom=None):
         SpatialExtent.__init__(self, "raster_spatial_extent",
         SpatialExtent.__init__(self, "raster_spatial_extent",
                                 ident, north, south, east, west, top, bottom)
                                 ident, north, south, east, west, top, bottom)
 
 
 class Raster3DSpatialExtent(SpatialExtent):
 class Raster3DSpatialExtent(SpatialExtent):
-    def __init__(self, ident=None, north=None, south=None, east=None, 
+    def __init__(self, ident=None, north=None, south=None, east=None,
                  west=None, top=None, bottom=None):
                  west=None, top=None, bottom=None):
         SpatialExtent.__init__(self, "raster3d_spatial_extent",
         SpatialExtent.__init__(self, "raster3d_spatial_extent",
                                 ident, north, south, east, west, top, bottom)
                                 ident, north, south, east, west, top, bottom)
 
 
 class VectorSpatialExtent(SpatialExtent):
 class VectorSpatialExtent(SpatialExtent):
-    def __init__(self, ident=None, north=None, south=None, east=None, 
+    def __init__(self, ident=None, north=None, south=None, east=None,
                  west=None, top=None, bottom=None):
                  west=None, top=None, bottom=None):
         SpatialExtent.__init__(self, "vector_spatial_extent",
         SpatialExtent.__init__(self, "vector_spatial_extent",
                                 ident, north, south, east, west, top, bottom)
                                 ident, north, south, east, west, top, bottom)
 
 
 class STRDSSpatialExtent(SpatialExtent):
 class STRDSSpatialExtent(SpatialExtent):
-    def __init__(self, ident=None, north=None, south=None, east=None, 
+    def __init__(self, ident=None, north=None, south=None, east=None,
                  west=None, top=None, bottom=None):
                  west=None, top=None, bottom=None):
         SpatialExtent.__init__(self, "strds_spatial_extent",
         SpatialExtent.__init__(self, "strds_spatial_extent",
                                 ident, north, south, east, west, top, bottom)
                                 ident, north, south, east, west, top, bottom)
 
 
 class STR3DSSpatialExtent(SpatialExtent):
 class STR3DSSpatialExtent(SpatialExtent):
-    def __init__(self, ident=None, north=None, south=None, east=None, 
+    def __init__(self, ident=None, north=None, south=None, east=None,
                  west=None, top=None, bottom=None):
                  west=None, top=None, bottom=None):
         SpatialExtent.__init__(self, "str3ds_spatial_extent",
         SpatialExtent.__init__(self, "str3ds_spatial_extent",
                                 ident, north, south, east, west, top, bottom)
                                 ident, north, south, east, west, top, bottom)
 
 
 class STVDSSpatialExtent(SpatialExtent):
 class STVDSSpatialExtent(SpatialExtent):
-    def __init__(self, ident=None, north=None, south=None, east=None, 
+    def __init__(self, ident=None, north=None, south=None, east=None,
                  west=None, top=None, bottom=None):
                  west=None, top=None, bottom=None):
         SpatialExtent.__init__(self, "stvds_spatial_extent",
         SpatialExtent.__init__(self, "stvds_spatial_extent",
                                 ident, north, south, east, west, top, bottom)
                                 ident, north, south, east, west, top, bottom)

+ 3 - 9
temporal/t.rast.neighbors/t.rast.neighbors.py

@@ -23,6 +23,9 @@
 #%option G_OPT_STRDS_INPUT
 #%option G_OPT_STRDS_INPUT
 #%end
 #%end
 
 
+#%option G_OPT_STRDS_OUTPUT
+#%end
+
 #%option G_OPT_T_WHERE
 #%option G_OPT_T_WHERE
 #%end
 #%end
 
 
@@ -36,14 +39,6 @@
 #%end
 #%end
 
 
 #%option
 #%option
-#% key: output
-#% type: string
-#% description: Name of the output space time raster dataset
-#% required: yes
-#% multiple: no
-#%end
-
-#%option
 #% key: method
 #% key: method
 #% type: string
 #% type: string
 #% description: Aggregate operation to be performed on the raster maps
 #% description: Aggregate operation to be performed on the raster maps
@@ -53,7 +48,6 @@
 #% answer: average
 #% answer: average
 #%end
 #%end
 
 
-
 #%option G_OPT_R_BASE
 #%option G_OPT_R_BASE
 #%end
 #%end
 
 

+ 2 - 1
temporal/t.unregister/t.unregister.py

@@ -162,7 +162,8 @@ def main():
         count += 1
         count += 1
 
 
     # Execute the collected SQL statenents
     # Execute the collected SQL statenents
-    dbif.execute_transaction(statement)
+    if statement:
+        dbif.execute_transaction(statement)
 
 
     grass.percent(num_maps, num_maps, 1)
     grass.percent(num_maps, num_maps, 1)