Scripting in Global Mapper

Using either Global Mapper Script or Python, scripting is a useful method for automating processes in Global Mapper. Script files allow the user to create custom batch processes that make use of the functionality built in to Global Mapper. From a script, one can import data in any of the numerous formats supported by the software, reproject it, perform analysis, export it to a new file, and more. The full list of Global Mapper Script commands can be found in the Global Mapper Scripting Reference.

The Scripting Toolbar contains tools to assist in script generation and editing:

  • Script Builder - record actions taken in the Global Mapper Interface as scripts.

  • Script Editor - create, view, edit and run scripts in Global Mapper.

  • Favorite Scripts - save and easily access favored script files.

 

Global Mapper's Scripting Language

This section references Global Mapper's native scripting language. Python is also supported in Global Mapper Pro.

For an online, hands on training course, see Principles of Global Mapper Scripting on the Blue Marble Geographics Online Classroom.

Global Mapper Script is created specifically for Global Mapper. Script files (.gms) consist of a series of command lines. Each command line begins with a command. A series of parameter/value pairs should follow the command. These pairs should be written as parameter=value. No spaces should exist before or after the equal sign. Individual parameter/value pairs should be separated by spaces. If a pair requires spaces internal to the value, quotes may be used around the entire value. For example, for a filename with spaces, the pair could look like FILENAME="c:\\my documents\\test.tif". Parameters that expect a value of YES or NO to enable or disable functionality can be enabled with just the parameter name. So rather than saying FLAG_PARAM_NAME=YES, you can just say FLAG_PARAM_NAME to get the same behavior as specifying yes.

Command lines typically consist of one line each. To extend a command to another line, use the backslash character (\) at the end of the line. There are a few exceptions to this, including the DEFINE_PROJ and DEFINE_SHAPE commands and the looping functionality provided by the DIR_LOOP_START and DIR_LOOP_END commands.

To access a list of commands, see the Global Mapper Scripting Reference.