SIGN IN

Custom Processing Scripts

Custom scripts are a piece of Javascript code you provide and are the way you control what values the Sentinel Hub services will return. Each of your layers requires a custom script. This is configurable in the Configuration Utility and a multitude of pre-configured data products are available which you may use directly or modify as necessary. You can also write your own custom scripts or copy them from the custom script repository.

The script can use any Javascript function or language structures, as long as a valid array of numbers with fixed number of elements is returned at any point. The number of the returned array elements represent the number of the components in the output image. Note that JPEG and PNG can only support 1 or 3 color components (plus an alpha channel, if set).

Custom scripts are available in 2 versions: a simple, so called Basic version, and a much more powerful Version 3. Both work with OGC, process API, EO Browser and Sentinel Playground. If you are familiar with previous versions V1 and V2, note that they are being deprecated and should be converted to V3. To make transition easier, we have prepared a converter.

Browse and Contribute Custom Scripts

You can find the custom scripts, which include indices, bands, composites and complex algorithms, on our Custom Script GitHub Repository.

You can participate in the Custom Script Contest and submit your scripts to earn a reward and contribute to the community. You can read about the 2019/2020 contest here.

Create Your Own Custom Scripts

For complete beginners, check out this tutorial, where Basic scripts with the examples from EO Browser are explained. The tutorial also includes an introduction to remote sensing.

For more complex V3 custom scripts, including for example multitemporal scripting, visit our Version 3 evalscript documentation. Here, you can also check out the available visualizators and utility functions, that can be used with custom scripts.

To learn about how to configure custom scripts in the WMS configurator, the available dataset inputs and output formats, start here. For information on API, visit our documentations on OGC and process API.

Blogs on Custom Scripts

Read about custom scripts in the following Medium blog posts.

Create Useful and Beautiful Satellite Images with Custom Scripts

Custom scripts: faster, cheaper, better! 15 tips for better scripts and more responsive requests

Multitemporal deforestation detection blog by Nicolas Karasiak

Get Creative and Solve a Remote Sensing Problem at Home from your PC and Win!

New Themes, Multi-Temporal Scripting and Other Improvements in EO Browser

Debugging

If you come across an error, or the script is not working, the following might help.

If an exception is thrown from a script then request execution is stopped and response with the exception message will be returned (note that formatting of the message depends on the service endpoint), which can be used as a simple debugging tool.

Debugging basic scripts example:

let message = "Hello world";
throw new Error(message);

// response: "Failed to evaluate script! Error: Hello world"

Debugging extended scripts example:

function setup(dataSource) {
    let message = "Hello world";
    throw new Error(message);
}

function evaluatePixel(samples) {
    // ...
}

// response: "Failed to evaluate script! Error: Hello world"