SIGN IN

Custom Processing Scripts

Custom scripts are a piece of Javascript code, used to visualize satellite imagery and to control what values the Sentinel Hub services will return. Any visualization of any constellation (e.g. Sentinel-2 satellite), even a simple true color composite, is dictated by a custom script. See a couple of visualizations on the gif below. You can view preconfigured visualization layers in EO Browser, Sentinel Playground, or create your own using the Configuration Utility, where a multitude of pre-configured data products are available for you to use directly or modify as necessary. You can also write your own custom scripts or copy them from the custom script repository.

Custom scripts are available in 2 versions: simple scripts, and advanced Version 3 scripts, which support multitemporal scripting and data fusion as well. Both work with OGC, process API, EO Browser and Sentinel Playground. If you are familiar with previous versions V1 and V2, note that they were deprecated and should be converted to V3. To learn about the transition, see a V3 transition guide.

Custom Scripts

Browse and Contribute Custom Scripts

You can find numerous free-to-use custom scripts, which include indices, bands, composites and complex algorithms, on our Custom Script GitHub Repository. Each script has a description, representative images and a link to EO Browser/Sentinel Playground, where you can test, explore and modify it. Scripts are ordered by data collection and by industry/use.

The Repository

You can participate in the Custom Script Contest and submit your scripts to earn a reward and contribute to the community. All the accepted scripts are available on the Custom Script GitHub Repository.

Contest page

Create Your Own Custom Scripts

For complete beginners, we have prepared a tutorial, where simple scripts with the examples from EO Browser are explained. The tutorial website includes an interactive short version, explaining EO Browser search and how to make RGB composites, and there’s also a youtube version of this. The PDF includes full content, including an introduction to remote sensing, RGB composites, and classified/continuous visualizations.

Beginner Scripting Tutorial Short Youtube Video Full Content PDF

For advanced V3 custom scripts, visit our Version 3 evalscript documentation. Here, you can also check out the available visualizers and utility functions, that can be used with custom scripts.

Advanced Script Documentation

See our live Custom Scripts webinar, where you will learn how to use custom scripts without any previous knowledge of coding. The webinar explains basic javascript concepts, such as functions and variables, and explains various use cases for simple and advanced scripts. For the webinar, an understanding of basic remote sensing concepts is expected (see the beginner PDF tutorial, chapters 1 to 3.1). To join similar live webinars in the future, register here, and we will inform you about the upcoming events.

Beginner Scripting Webinar

Check out our more advanced webinar on multi-temporal scripts and data fusion as well.

Multitemporal Scripts and Data Fusion Webinar

To see which bands can be input into custom scripts, check our documentation on data collections, Available Bands and Data section under each one. For information on API, visit our documentations on OGC and process API.

Classifier

A technical note on custom scripts

A script can use any Javascript function or language structure, as long as a valid array of numbers with a fixed number of elements is returned at any point. The number of the returned array elements represents the number of the components in the output image (e.g. 1 for grayscale results, or 3 for a colorful RGB composite, such as return [B04, B03, B02]). Note that JPEG and PNG can only support 1 or 3 color components (plus an alpha channel, if set). A custom script is run per each pixel of your raster band, and it assignes a new value to the same pixel. Check out the tutorials and webinars above to learn all about scripting.

Blog Posts on Custom Scripts

Read about custom scripts in the following Medium blog posts.

Follow our Medium for new blog posts. You can access the custom script category directly here.

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 simple 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"