GGL2 API for Java and Python

We are pleased to announce that the GGL2 tools are increasing constantly. The newcomer today is an API for Java and Python.

This API allows developers to execute GGL2 processes from their programs with a single call, passing the GGL2 code as a parameter. Thus, Java and Python developers can now run GGL2 algorithms using their own language easily.

In order to use this API, GGL2 must be installed and the installation directory specified before executing GGL2 code. Then, the execute call will run the GGL2 code and will return normally if the process finishes successfully or will throw an exception if anything fails. Different exceptions will be thrown depending on whether the error has been a GGL2 compilation error, a GGL2 execution error or any other unexpected error.

For Java developers, the GGL2 API is available with and without Maven. In the end, the necessary jars must be included in the classpath and then a simple program like this example can be executed:

import org.gearscape.ggl.GGL2;

public class Main {

    public static void main(String[] args) throws Exception {

        GGL2 ggl2 = new GGL2("/home/victorzinho/bin/ggl");

        ggl2.execute("show 'Hello World!';");



For Python developers the module containing the GGL2 API must be imported. The previous example can be executed as follows:

import GGL2

GGL2.location = '/home/user/bin/ggl'
GGL2.execute("show 'Hello World!';")

There is a complete tutorial on how to configure and use the API with both Java and Python in [1].



Do you have a project idea and want to turn it into reality? We would like to hear from you, tell us about it

The facts define us

  • 9 years with Barcelona Natural Science Museum

    Geolocation is a key attribute for activity in a natural science museum since cartography is present in almost all its fields of activity: collections, research, publications, exhibitions, etc. The collaboration…

  • Civil works monitoring using satellite imagery and machine learning

    Using up-to-date satellite imagery is nowadays mandatory to the decision-making process in many areas: agriculture, environment, water resources … Checking present and historical views of a site can be of…

  • Customised GIS training for your sector

    Our experience tells us that the best way to consolidate knowledge and have your staff effectively integrate GIS as a daily tool is through customised courses for your business. Generalist…

  • One kilometer from home

    On March the 23rd, after five weeks of COVID-19 lockdown, president Sanchez announced that Spain will begin easing restrictions. In this first attempt at  loosening measures across the country, children…