How to Work with TerraBuilder API

To work with TerraBuilder API, perform the following steps:

1.     Create a JavaScript file using the TerraBuilder API objects. SeeTerraBuilder Objects” and the code samples in “API Examples” in this chapter. For example:

var project = TerraBuilder.OpenProject("C:\\TB Projects\\USA.tbp");

Project.Layers.InsertLayer("C:\\TB Sources\\NY.tif","imagery");

project.Save();

TerraBuilder.ExitWhenFinished();

2.     Save the script file with a js extension.

3.     Execute the JavaScript from the command line using the following syntax:

TerraBuilder.exe -script “…..script.js (path to script)

Note:    Each line in the TB script, once executed, is recorded and displayed in the TerraBuilder log as a message (in addition to TerraBuilder.Print printouts). You can disable the code line printing by passing the DisablePrint argument:

TerraBuilder.exe -script “…..script.js (path to script)-DisablePrint