You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Removed playground references, made parser for example links
* Working for Sentinel 2
* Made examples more modular and machine readable. Removed playground links, added Copernicus Browser examples
* fixed layouts
Copy file name to clipboardexpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ For instructions on how custom scripts are structured have a look at this [tutor
29
29
_Obviously, you'll want to remove this chapter, but use the rest of the file as a template._
30
30
_Have a look around at other `README.md` files to see how to include images, format the text and generally use the GitHub [markdown](https://help.github.com/categories/writing-on-github/) (e.g. [here](../sentinel-2/cby_cloud_detection/README.md) for mathematical formulas or [here](../sentinel-2/ndvi_uncertainty/README.md) for adding images)._
31
31
- Implement the product in the `script.js` file.
32
-
_The most work is of course the JavaScript implementation of the product. The `example` folder includes an empty custom script with comments that will hopefully help you build your own custom script. Of course the easiest is to do the custom script building/testing on [Sentinel Playground](https://apps.sentinel-hub.com/sentinel-playground/)._
32
+
_The most work is of course the JavaScript implementation of the product. The `example` folder includes an empty custom script with comments that will hopefully help you build your own custom script._
33
33
- Add an entry pointing to your script to the top level markdown file (i.e. if adding a script for Sentinel 2 add the link to `sentinel-2.md` in the folder `sentinel-2`).
Copy file name to clipboardexpand all lines: contribute/index.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ For instructions on how custom scripts are structured have a look at this [tutor
26
26
_Obviously, you'll want to remove this chapter, but use the rest of the file as a template._
27
27
_Have a look around at other `README.md` files to see how to include images, format the text and generally use the GitHub [markdown](https://help.github.com/categories/writing-on-github/) (e.g. [here](../sentinel-2/cby_cloud_detection/README.md) for mathematical formulas or [here](../sentinel-2/ndvi_uncertainty/README.md) for adding images)._
28
28
- Implement the product in the `script.js` file.
29
-
_The most work is of course the JavaScript implementation of the product. The `example` folder includes an empty custom script with comments that will hopefully help you build your own custom script. Of course the easiest is to do the custom script building/testing on [Sentinel Playground](https://apps.sentinel-hub.com/sentinel-playground/)._
29
+
_The most work is of course the JavaScript implementation of the product. The `example` folder includes an empty custom script with comments that will hopefully help you build your own custom script._
30
30
- Add an entry pointing to your script to the top level markdown file (i.e. if adding a script for Sentinel 2 add the link to `sentinel-2.md` in the folder `sentinel-2`).
Copy file name to clipboardexpand all lines: dem/contour-lines/README.md
+47-44
Original file line number
Diff line number
Diff line change
@@ -6,96 +6,99 @@ permalink: /dem/contour-lines/
6
6
nav_exclude: true
7
7
---
8
8
9
-
10
9
## Description
11
10
12
-
This script uses DEM to calculate and display contour lines. They are calculated using `c = 20 * Math.floor(d / 20)`. The visualization can be manipulated in a number of ways. The number `35` in the first conditional statement below sets the increments between the contour lines; in this case, the spacing between the contour lines means that the elevation difference between them is 35 meters. This means, that the contour lines will be further apart where the elevation is lower. The number `5` in the script below sets the contour line thickness to be pretty low. The first return statement `return [0,0,0]` sets the color of the contour lines to black, and the colorBlend maps the areas in between in terrain colors, based on the terrain elevation model borders.
11
+
This script uses DEM to calculate and display contour lines. They are calculated using `c = 20 * Math.floor(d / 20)`. The visualization can be manipulated in a number of ways. The number `35` in the first conditional statement below sets the increments between the contour lines; in this case, the spacing between the contour lines means that the elevation difference between them is 35 meters. This means, that the contour lines will be further apart where the elevation is lower. The number `5` in the script below sets the contour line thickness to be pretty low. The first return statement `return [0,0,0]` sets the color of the contour lines to black, and the colorBlend maps the areas in between in terrain colors, based on the terrain elevation model borders.
13
12
14
13
## Representative Images and Examples
15
14
16
15
### Example 1
17
16
18
-
The following example will return black contour lines of thickness 5 in 35 meter increments on top of our standard DEM continuous color visualization.
17
+
The following example will return black contour lines of thickness 5 in 35 meter increments on top of our standard DEM continuous color visualization.
19
18
20
-
[View in Sentinel Playground](https://apps.sentinel-hub.com/sentinel-playground/?source=DEM&lat=41.645342272880455&lng=-7.038757314439863&zoom=13&preset=CUSTOM&layers=DEM,DEM,DEM&maxcc=20&gain=1.0&gamma=1.0&time=2019-05-01%7C2019-11-21&atmFilter=&showDates=false&evalscript=dmFyIGQgPSBERU07CmlmIChkICUgMzUgPCA1KSB7CiAgcmV0dXJuIFswLDAsMF0KfQp2YXIgYyA9IDIwICogTWF0aC5mbG9vcihkIC8gMjApOwpyZXR1cm4gY29sb3JCbGVuZChjLCBbLTEyMDAwLC05MDAwLC02MDAwLC0xMDAwLC01MDAsLTIwMCwtNTAsLTIwLC0xMCwwLDEwLDMwLDUwLDIwMCwzMDAsNDAwLDUwMCwxMDAwLDMwMDAsNTAwMCw3MDAwLDkwMDBdLApbWzAuMDAwLCAwLjAwMCwgMC4xNTddLApbMC4xMTgsIDAuMDAwLCAwLjM1M10sClswLjExOCwgMC4xMTgsIDAuNDcxXSwKWzAuMTU3LCAwLjE5NiwgMC43MDZdLApbMC4yMzUsIDAuMjM1LCAwLjkwMl0sClswLjIzNSwgMC4zMTQsIDAuOTYxXSwKWzAuMzUzLCAwLjMzMywgMC45ODBdLApbMC40NzEsIDAuNDcxLCAwLjkyMl0sClswLjYyNywgMC42MjcsIDEuMDAwXSwKWzAuNzg0LCAwLjc4NCwgMC43ODRdLApbMC4zOTIsIDAuMjIwLCAwLjIzNV0sClswLjQ3MSwgMC4xODAsIDAuMTU3XSwKWzAuNTQ5LCAwLjI5OCwgMC4xNTddLApbMC42NjcsIDAuMzc2LCAwLjAwMF0sClswLjQ3MSwgMC4yMjAsIDAuMzUzXSwKWzAuODI0LCAwLjU3MywgMC43MDZdLApbMC41NDksIDAuNDMxLCAwLjAwMF0sClswLjQ3MSwgMC41NDksIDAuNzA2XSwKWzAuNjI3LCAwLjY2NywgMC45NDFdLApbMC43NDUsIDAuNzg0LCAwLjk4MF0sClswLjg2MywgMC45NDEsIDEuMDAwXSwKWzEuMDAwLCAxLjAwMCwgMS4wMDBdXSk%3D)
19
+
[See it in EO Browser](https://sentinelshare.page.link/uVTP)
We can make multiple contour lines, each in different increments and different color. It's also possible to return all other values transparent, so that contour lines can be downloaded and overlayed over other datasets. The following example returns 35 meter contour lines in black, 50 meter contour lines in red and all other pixels transparent. On the image, you can see Carto Voyager basemap under the contour lines.
64
+
We can make multiple contour lines, each in different increments and different color. It's also possible to return all other values transparent, so that contour lines can be downloaded and overlayed over other datasets. The following example returns 35 meter contour lines in black, 50 meter contour lines in red and all other pixels transparent. On the image, you can see Carto Voyager basemap under the contour lines.
58
65
59
-
To display this script, either use a processing API, or EO Browser. In EO Browser, data fusion needs to be used to access DEM dataset.
66
+
To display this script, either use a processing API, or EO Browser. In EO Browser, data fusion needs to be used to access DEM dataset.
60
67
61
68
[See it in EO Browser](https://apps.sentinel-hub.com/eo-browser/?zoom=13&lat=45.76735&lng=15.28576&themeId=DEFAULT-THEME&datasetId=S2L2A&fromTime=2020-09-30T00%3A00%3A00.000Z&toTime=2020-09-30T23%3A59%3A59.999Z&visualizationUrl=https%3A%2F%2Fservices.sentinel-hub.com%2Fogc%2Fwms%2Fbd86bcc0-f318-402b-a145-015f85b9427e&evalscript=Ci8vVkVSU0lPTj0zCi8vQXV0aG9yOiBNb25qYSBCLiDFoGViZWxhCgpmdW5jdGlvbiBzZXR1cCgpIHsKICByZXR1cm4gewogIAlpbnB1dDogWwogICAgCXtkYXRhc291cmNlOiAiUzJMMkEiLCBiYW5kczpbIkIwNCIsICJCMDMiLCAiQjAyIl19LAogICAgCXtkYXRhc291cmNlOiAiREVNIiwgYmFuZHM6WyJERU0iXX1dLAogIAlvdXRwdXQ6IFsKICAgIAl7aWQ6ICJkZWZhdWx0IiwgYmFuZHM6IDR9CiAgCV0KICB9Owp9CgpmdW5jdGlvbiBldmFsdWF0ZVBpeGVsKHNhbXBsZXMsIGlucHV0RGF0YSwgaW5wdXRNZXRhZGF0YSwgY3VzdG9tRGF0YSwgb3V0cHV0TWV0YWRhdGEpewogICAgdmFyIFMyID0gc2FtcGxlcy5TMkwyQVswXQogICAgdmFyIERFTU0gPSBzYW1wbGVzLkRFTVswXQogICAgdmFyIERFTSA9IERFTU0uREVNCgogICAgdmFyIGQgPSBERU07CmlmIChkICUgMzUgPCA1KSB7CiAgcmV0dXJuIFswLDAsMCwxXQp9CiAgaWYgKGQgJSA1MCA8IDUpIHsKICByZXR1cm4gWzEsMCwwLDFdCn0KCmVsc2V7CiAgcmV0dXJuIFswLDAsMCwwXQp9Cn0KICA%3D&dataFusion=%5B%7B%22id%22%3A%22AWS_S2L2A%22%2C%22alias%22%3A%22S2L2A%22%7D%2C%7B%22id%22%3A%22AWS_DEM%22%2C%22alias%22%3A%22DEM%22%7D%5D#custom-script).
62
69
63
70
```javascript
64
71
var d =DEM;
65
72
if (d %35<5) {
66
-
return [0,0,0,1]
73
+
return [0,0, 0, 1];
67
74
}
68
75
if (d %50<5) {
69
-
return [1,0,0,1]
70
-
}
71
-
else{
72
-
return [0,0,0,0]
76
+
return [1, 0, 0, 1];
77
+
} else {
78
+
return [0, 0, 0, 0];
73
79
}
74
80
```
75
81
76
82

77
83
78
84
### Example 3
79
85
80
-
Making contour lines very thick and returning them white, while returning everything else using a color visualization, gives the impression of colored contour lines on a white background.
86
+
Making contour lines very thick and returning them white, while returning everything else using a color visualization, gives the impression of colored contour lines on a white background.
81
87
82
-
[View in Sentinel Playground](https://apps.sentinel-hub.com/sentinel-playground/?source=DEM&lat=40.44593462678334&lng=-8.156147003173828&zoom=14&preset=CUSTOM&layers=DEM,DEM,DEM&maxcc=20&gain=1.0&gamma=1.0&time=2019-05-01%7C2019-11-21&atmFilter=&showDates=false&evalscript=dmFyIGQgPSBERU07CmlmIChkICUgMjAgPCAxOCkgewogIHJldHVybiBbMSwxLDFdCn0KdmFyIGMgPSAyMCAqIE1hdGguZmxvb3IoZCAvIDIwKTsKcmV0dXJuIGNvbG9yQmxlbmQoYywgWy0xMjAwMCwtOTAwMCwtNjAwMCwtMTAwMCwtNTAwLC0yMDAsLTUwLC0yMCwtMTAsMCwxMCwzMCw1MCwyMDAsMzAwLDQwMCw1MDAsMTAwMCwzMDAwLDUwMDAsNzAwMCw5MDAwXSwKW1swLjAwMCwgMC4wMDAsIDAuMTU3XSwKWzAuMTE4LCAwLjAwMCwgMC4zNTNdLApbMC4xMTgsIDAuMTE4LCAwLjQ3MV0sClswLjE1NywgMC4xOTYsIDAuNzA2XSwKWzAuMjM1LCAwLjIzNSwgMC45MDJdLApbMC4yMzUsIDAuMzE0LCAwLjk2MV0sClswLjM1MywgMC4zMzMsIDAuOTgwXSwKWzAuNDcxLCAwLjQ3MSwgMC45MjJdLApbMC42MjcsIDAuNjI3LCAxLjAwMF0sClswLjc4NCwgMC43ODQsIDAuNzg0XSwKWzAuMzkyLCAwLjIyMCwgMC4yMzVdLApbMC40NzEsIDAuMTgwLCAwLjE1N10sClswLjU0OSwgMC4yOTgsIDAuMTU3XSwKWzAuNjY3LCAwLjM3NiwgMC4wMDBdLApbMC40NzEsIDAuMjIwLCAwLjM1M10sClswLjgyNCwgMC41NzMsIDAuNzA2XSwKWzAuNTQ5LCAwLjQzMSwgMC4wMDBdLApbMC40NzEsIDAuNTQ5LCAwLjcwNl0sClswLjYyNywgMC42NjcsIDAuOTQxXSwKWzAuNzQ1LCAwLjc4NCwgMC45ODBdLApbMC44NjMsIDAuOTQxLCAxLjAwMF0sClsxLjAwMCwgMS4wMDAsIDEuMDAwXV0p)
88
+
[See it in EO Browser](https://sentinelshare.page.link/xtqG)
83
89
84
90

85
91
86
92
### Example 4
87
93
88
-
It is also possible to return contour lines of any color on top of a true color visualization of anoter satellite. However, for this, data fusion is needed. In the example below, Landsat 8 true color visualization was used under white contour lines.
94
+
It is also possible to return contour lines of any color on top of a true color visualization of anoter satellite. However, for this, data fusion is needed. In the example below, Landsat 8 true color visualization was used under white contour lines.
89
95
90
96
[DEM contour lines over Landsat 8 data fusion script](https://custom-scripts.sentinel-hub.com/data-fusion/dem_contour_over_l8/)
0 commit comments