BlueSpray - Help
© SchoonerTurtles, Inc. 2012-2015

Introduction
Contents
Getting Started
Download
Navigating
Tutorials
Scripting
Advanced
About

Overview of Scripting

BlueSpray interfaces with the popular Python programming language giving you full access to all the capabilities of BlueSpray with the flexibility of a programming language. You may be familiar with Python from other programming tasks.

You'll need to install the Py4J library to create a bridge between Python and BlueSpray. With Py4J you can access all of the capabilities of Java and most of the functionality of BlueSpray.

All code in Java is organized first into "classes" and then related classes are combined into "Packages". A great feature of JavaScript is that you can access any of the classes in Java from JavaScript. This includes all the standard packages defined by Oracle. You only need to include the package that contains the class you want to access and then call the functions in the class.

BlueSpray includes a large number of classes and we've documented a set of classes and functions witin them that are managed for developers. This means we will keep these functions as they are defined so that you don't have to rewrite your code when we roll BlueSpray. If we do change or remove a function we will obsolete it first. This means we will mark it as obsolete (going away) for one year to allow you to change your code to new functions and then remove it. You can also access other functions within BlueSpray but we may change them without notice in new versions.

Calling BlueSpray

The easiest way to call BlueSpray is through the BlueSprayPy.py library that is included in the STPython folder in the BlueSpray folder you downloaded. This library will setup the connection to BlueSpray through Py4J and provides functions that make it easier to access BlueSpray. We recommend running the examples that are available in the same folder as BlueSprayPy and checking out their code before continuing.

If BlueSprayPy does not provide a function you need, you can call BlueSpray directly using the reference material for the scripting classes in the Scripting Reference.

Packages

The following packages contain classes that are typically used by scripts.

  • File - classes to access data in files, databases, and on the network
  • Raster - classes to use and process raster (grid) data. This package includes the most commonly used raster transforms
  • RasterTransforms - additional transforms
  • Vector
  • VectorTransforms
  • Table - functions to create and manipulate tables of data including attributes associated with vector data
  • SRS - classes to manage spatial reference systems

Commonly Used Classes

  • STFileManager - classes to access data in files, databases, and on the network
  • STRaster - classes to use and process raster (grid) data. This package includes the most commonly used raster transforms
  • STRasterTransforms - additional transforms
  • STVector
  • STVectorTransforms
  • STTable - functions to create and manipulate tables of data including attributes associated with vector data
  • STSRS - classes to manage spatial reference systems

Some processes can take a long time and these functions allow you to speify a process containing a progress dialog. This is easy to do, just create a new STProcess object when you call the function. Just pass null for "TheProcess" parameter and the progress bars will not appear.

Note: BlueSpray uses standard Java exception handling for errors. You do not need to "catch" these errors in your JavaScripts as we will redirect the error to your output. You'll see the error and the stack trace for where the error occurred. There will be more ifnormatoin on this a little later.

STFileManager

The file manager can be used to convert files from one file format to another. The file manager can also be used to load the contents of files into objects for more complex scripts. You'll learn more about this when you go beyond the managers.

STTable

You can load, manipulate and perform some analysis on data within an STTable class in BlueSpray. Tables are also used to hold attributes for layers and the coordinates for points in a layer.

STRaster

A raster object contains a 2-dimensional grid of "picture elements" or "pixels". This is sometimes refered to as a "grid" in GIS.

STRegion

A region object contains vector data that is either polyline or polygon. This object handles the data very quickly and the data can be topological or non-topological.

STLayer

The STLayer class has three subclasses: STLayerPoints, STLayerRegions, and STLayerRaster that hold and operate on layers of spatial data within a scene.

STProjectorManager

With one line of script you can convert any georeferenced file to another coordinate refernece system (CRS). You can also findout the CRS for a file and define the CRS if it is missing or is incorred.

Error Messages and Debugging Scripts

Scripting Errors

There are a number of error messages you may see in the bottom pane of the script editor. These should include a line number of where the error occurs and sometimes contain other valuable information (othertimes, they can be missleading as to the error).

Missing Name: Can't find the function :

BlueSpray Errors

BlueSpray can also produce errors which will be displayed in the same window as scripting errors.