Introduction
This post demonstrates how to add the definition of processes to Karttur’s GeoImagine Framework. The processes as such are not added, only the parameters required for running the processes are added to the database. Instead of running the setup described in this post, you can restore the complete Framework database, including process definitions, by restoring or importing the default version of the postgres database.
Prerequisites
You must have the complete Spatial Data Integrated Development Environment (SPIDE) installed as described in the blog Install and setup spatial data IDE. Then you must also have imported the Framework to Eclipse, or another Integrated Development Environment (IDE). You must also have prepared a solution for how to link the Framework processes and the postgres database.
Framework processes
All functionalities of Karttur’s GeoImagine Framework are called processes and operate based on parameters defined in the Framework database. Thus a process must be defined in the database before it can be used. Processes are grouped in roots, where a root is usually associated either with a typical class of functions (e.g. overlay, scalar, export), data sources (e.g Landsat, Sentinel, MODIS etc) or projection system.
If you followed the tutorial on how to set up the database one root group (manageprocess) and one process (addsubproc) were inserted in the database. This added the capability of defining all other processes.
Access to complete lists of both root processes and sub processes, or via the top menu.
Python package setup_processes
The setup of processes is done from the special package setup_processes. This package contains four .py files, the standard modules __init__.py and version.py, plus one main module and one process module:
- setup_process_main.py
- setup_process_process.py
The package also contains several subfolders. The package subfolder dbdoc contains all the core processes, whereas the other sub-folders (landsatdoc, modisdoc, regiondoc etc) contain thematic processes and default or template data related to different data source systems.
Get the package
If you cloned or imported the complete Framework, you already have the setup_processes package in your Eclipse PyDev project. If you need to add the package, follow the instruction in the previous post on setup_db, download setup_processes package and create a sub-package also called setup_processes and drag the complete content of the download into that sub-package.
setup_processes_main.py
From the module setup_process_main.py you install all the processes and also the projection systems and data required to run the Framework.
if __name__ == "__main__":
'''
This module should be run after the module setup_db when building the Karttur GeoImagine Framework.
'''
# Set the name of the productions db cluster
# prodDB = 'YourProdDB' #'e.g. postgres or geoimagine
prodDB = 'geoimagine'
# Setupprocesses links to a text file defining Framework processes to define
SetupProcesses(prodDB)
# SetupDefaultRegions starts a subroutine with different region processing
SetupDefaultRegions(prodDB)
# To setup custom projection and tiling systems, remove the comment
#SetupCustomGrids(prodDB)
# BackupDatabase creates a backup of the entire db in different formats
#BackupDatabase(prodDB)
exit(' REACHED THE END! ')
Setup processes
In the main module, setup_process_main.py, you need to set the name of the production database that you created when you did setup db.
if __name__ == "__main__":
...
# Set the name of the productions db cluster
# prodDB = 'YourProdDB' #'e.g. postgres or geoimagine
prodDB = 'geoimagine'
...
In the subroutine SetupProcesses the path to the actual text file (process_karttur_setup_YYYYMMDD.txt.) listing the json command files to execute is given. Edit the link if you created a new version of this text file.
def SetupProcesses(prodDB):
''' Setupprocesses links to a text file defining Framework processes to define
'''
relativepath = 'dbdoc'
txtfilename = 'process_karttur_setup_20211108.txt'
SetupProcessesRegions(relativepath, txtfilename, prodDB)
The json commands for setting up the Framework processes are linked via the text file process_karttur_setup-ease-grid_YYYYMMDD.txt. It contains a single json command file for setting up the tables for the systems ease2n and ease2s.
The linked command files all have the element "overwrite" set to false (see the post on Json elements, variables and objects). This means that no existing data or database record will be overwritten if it exists. You can thus rerun the command files without anything happening. Only if you make changes in the json commands and change "overwrite" to true will any changes take effect.
Setup regions
The next post deals with setting up the projection systems and defining regional extents.