PCI Geomatics Help Center

How can we help you today?

Running a Geomatica Algorithm in Python

PCI Geomatics -



The purpose of this tutorial is to explain how to run a Geomatica Algorithm within the Python environment. Once you understand this concept you will be able to combine multiple algorithms into a full workflow script.



This tutorial is designed for beginners. It demonstrates to current Geomatica users how to automate common Geomatica algorithms with Python. It can also be used as a starting point for developers who are new to Geomatica’s library.



Data Package


  • Click Here to download the data required for this tutorial



Before you add a Geomatica algorithm to your python script find the algorithm in the Geomatica Help. There are examples listed in the help on how to run each algorithm in python. When looking up an algorithm in the Help simply select Python as the chosen environment at the top of the help window. Each of the algorithm parameters are listed in the help. The required parameters are indicated with a *. Whenever you are using an algorithm in your python script make sure to check that you have defined every required parameter. At the bottom of the help window for each algorithm is an example of how to run that algorithm in Python.

In the next step we will create a simple script to run the fimport algorithm. Before you start the script look up fimport in the Geomatica Help to see what parameters you need to set. You can also check the example in the help to see how to call fimport.

Running the FIMPORT Algorithm in Python


This script is a very simple example of running fimport with a Quick Bird image.

from pci.fimport import fimport

fimport(fili=r"C:\PCI Geomatics\Geomatica 2015\demo\Toronto\QB_multispectral.jp2",
        filo=r"C:\PCI Geomatics\Geomatica 2015\demo\Toronto\Multi.pix",

print "FIMPORT Complete"


  • You will need to change the variables to correspond to your data. From looking at the help you will notice that only fili and filo are required parameters. You can choose to leave the other three parameters as their defaults or define them based on your dataset.
  • In the fimport.py file, each of the required arguments is first set as a variable (i.e. fili = u””) and then that variable is used as an argument when fimport is later called. These types of arguments are called positional arguments and they must be listed in a specific order (as outlined in the help). In our tutorials keyword arguments will be used instead of positional arguments. In the script above, the arguments have been changed to keyword arguments. With keyword argument, you identify and define the arguments based on the parameter name. When using keyword arguments you are not required to enter the arguments in any specific order. However, in this tutorial the arguments will be listed in the same order as outlined in the help. Additionally, any arguments that are not required by the algorithm can be skipped. The default values (as specified in Geomatica help) will be used for the undefined arguments. In the script only fili, filo and dblayout have been listed, as dbiw and poption will be left as defaults.
  • Run the script that you just created. If you open the directory that you set for filo, you will notice that your new pix image has been created.
  • If the script did not run properly an error message will be printed to the python shell. For example, if your fili pathname is incorrect you will receive an error saying that the file does not exist. You will need to fix the issue in your script and rerun it.

Have more questions? Submit a request


Powered by Zendesk