Skip to content

Commit

Permalink
t.unregister: add support to unregister maps from other mapsets (#2447)
Browse files Browse the repository at this point in the history
* add support to unregister maps from other mapsets in the TGIS db of the current mapset

Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>

Co-authored-by: anikaweinmann <aweinmann@mundialis.de>
Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 17, 2022
1 parent 7a7d810 commit bfbe003
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions temporal/t.unregister/t.unregister.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

import grass.script as grass


# lazy imports at the end of the file

############################################################################
Expand All @@ -77,6 +76,13 @@ def main():
dbif = tgis.SQLDatabaseInterfaceConnection()
dbif.connect()

# modify a stds only if it is in the current mapset
# remove all connections to any other mapsets
# ugly hack !
currcon = {}
currcon[mapset] = dbif.connections[mapset]
dbif.connections = currcon

# In case a space time dataset is specified
if input:
sp = tgis.open_old_stds(input, type, dbif)
Expand Down Expand Up @@ -129,7 +135,7 @@ def main():
map = tgis.dataset_factory(type, mapid)

# Unregister map if in database
if map.is_in_db(dbif):
if map.is_in_db(dbif, mapset=mapset):
# Unregister from a single dataset
if input:
# Collect SQL statements
Expand Down

0 comments on commit bfbe003

Please sign in to comment.