Programming in Geocap

Introduction

Geocap has a powerful shell command language consisting of more than 200 commands (see Reference Manual). Their are used for visualization and data manipulation. Nearly all basic functionality in the software have an equivalent in a shell command. The Geocap shell command language is defined on top of Tcl commands and benefits from the Tcl command features like use of variables, if-then-else-while-do constructions and general input and output. In addition Geocap supports the Tcl extension QTcl which enabled the user to generate any kind of user interface or menu to a script.

A combination of the Geocap shell-, Tcl- and QTcl-commands can be scripted into fully functional commands with menus, which can be executed directly on a dataset or folder in a project, the same way as the built-in commands in Geocap.



In this section:

Basic concepts

In order to be able to use the command language, it is essential to understand the interaction between the Project manager, the Command Shell, and the Workspace.

The black arrows in the diagram above show that data can be moved freely between the project and the active memory and memory locations of Geocap. The red lines show that by typing in commands in the command shell, the user can perform operations on the active memory and on data in specific memory locations. Since there are script commands that can move data between the Geocap memory and the project, the scripts can operate on all data in Geocap.

The Geocap workspace works the same way as the memory of a scientific calculator, but there are some differences:

  • Geocap can have more than 9 memory locations.
  • The user is free to name the locations to descriptive names.
  • The memory of Geocap can hold grids, points, lines, and numbers.
  • The Geocap memory (workspace) is cleared when exiting the program. Any data in the workspace that is to be saved, must be moved to the project.

Moving data between locations

It is possible to interact efficiently with the workspace in various ways.

Move data from the project to the workspace

  1. Right-click the dataset in the project and select Copy.
  2. Click the icon in the Shell and Workspace tab in the Toolbox

Move data from workspace to the project

  1. Right-click the dataset in the workspace and select Copy
  2. Right-click a folder in the project and select Paste

or

  • Right-click a generic folder, go to New > Workspace Data and select the dataset in the workspace.

Move data from the project to the active memory

  • Right-click the dataset i the project and select Make active

Move data from the active memory to the project

  1. Right-click the active dataset in the workspace and select Copy
  2. Right-click a folder in the project and select Paste

or

  • Right-click a generic folder, go to New > Workspace Data and select the active dataset in the workspace.

Move data from the active memory to the workspace

  • Type in mhi and name in the command shell e.g. mhi dataset1

You should now have a dataset named dataset1 in the workspace.

Move data from the workspace to the active memory

  • Type in mlo and the dataset name in the cmmand shell e.g. mlo dataset1

or

  • Right click the dataset in the workspace and select Make active

dataset1 should now be the active dataset.

Overwrite existing dataset in project

  • Right-click the dataset in the project, go to Assign from workspace... and select the dataset in the workspace.