Skip to content

Commit 1c122ff

Browse files
committed
v0.4.0
2 parents 28732a9 + d51e791 commit 1c122ff

File tree

10 files changed

+1727
-718
lines changed

10 files changed

+1727
-718
lines changed

.gitignore

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
# NPM
12
node_modules/
2-
/dist
33
/package-lock.json
44

5-
/nbproject/
6-
.vscode
5+
# Build related
6+
/openeo.min.js
77

8+
# Reports
89
coverage/
9-
/test-report.html
10+
docs/
11+
12+
# Temporary files from the earthengine tests
13+
/lorem.txt
14+
/randomnumber.txt
15+
/downloaded_file.txt

.jshintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"curly": true,
3+
"eqeqeq": true,
4+
"esversion": 8,
5+
"freeze": true,
6+
"futurehostile": true,
7+
"noarg": true,
8+
"nocomma": true,
9+
"nonbsp": true,
10+
"undef": true,
11+
"unused": true,
12+
"browser": true,
13+
"node": true,
14+
"globals": {
15+
"axios": true,
16+
"define": true
17+
}
18+
}

.travis.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,27 @@ cache:
1010
- "node_modules"
1111

1212
script:
13+
# Run code checks
14+
- npm run compat
15+
# Run tests
1316
- npm run test
14-
- npm run test_node
17+
- npm run test_node
18+
# - npm run test_gee
19+
# Build
20+
- npm run build
21+
# Generate docs
22+
- npm run docs
23+
# Deploy
24+
- git clone --branch gh-pages https://$GITHUB_TOKEN@github.com/Open-EO/openeo-js-client.git gh-pages
25+
- cd gh-pages
26+
- cp -R ../docs/@openeo/js-client/* .
27+
28+
deploy:
29+
provider: pages
30+
skip-cleanup: true
31+
github-token: $GITHUB_TOKEN
32+
keep-history: true
33+
committer-from-gh: true
34+
local-dir: gh-pages
35+
on:
36+
all_branches: true

README.md

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,57 @@ JavaScript client for the openEO API.
44

55
[![Build Status](https://travis-ci.org/Open-EO/openeo-js-client.svg?branch=master)](https://travis-ci.org/Open-EO/openeo-js-client)
66

7-
This client is in **version 0.3.5** and supports **openEO API versions 0.3.0 and 0.3.1**. Legacy versions are available as releases.
7+
The version of this client is **0.4.0** and supports **openEO API version 0.4.x**. Legacy versions are available as releases.
88

99
## Usage
10-
This library can run in a recent browser supporting ECMAScript 2015 or node.js.
10+
11+
This library can run in node.js or any recent browser supporting ECMAScript 2017 (ES8). This includes [mostly all browsers released after mid 2017, but excludes Internet Explorer 11](https://caniuse.com/#search=async%20functions).
12+
13+
### Browser environment
1114

1215
To use it in a browser environment simply add the following code to your HTML file:
1316
```html
1417
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
15-
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client/openeo.js"></script>
18+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client/openeo.min.js"></script>
1619
```
1720

18-
To install it with npm run: `npm install @openeo/js-client`
21+
### NodeJS environment
22+
23+
To install it in a NodeJS environment run: `npm install @openeo/js-client`
24+
25+
Afterwards, you can import the package: `const { OpenEO } = require('@openeo/js-client');`
26+
27+
### Advanced options
28+
29+
Generate a minified build: `npm run build`
30+
31+
Generate the documentation to the `docs/` folder: `npm run docs`
32+
33+
Check against the coding guidelines: `npm run compat`
34+
35+
Run tests:
36+
37+
* `npm run test` (basic browser-based tests)
38+
* `npm run test_node` (basic node-based tests)
39+
* `npm run test_gee` (full test suite using the Google Earth Engine back-end as server)
1940

2041
### Running a job
2142

2243
```js
23-
// Import the library if running in a nodeJS environment
24-
// const { OpenEO } = require('@openeo/js-client');
25-
26-
var obj = new OpenEO();
2744
// Show the client version
28-
console.log("Client Version: " +obj.version());
45+
console.log("Client Version: " + OpenEO.clientVersion());
2946

3047
try {
3148
// Connect to the back-end
32-
var con = await obj.connect("https://earthengine.openeo.org/v0.3", "basic", {username: "group1", password: "test123"});
49+
var con = await OpenEO.connect("https://earthengine.openeo.org", "basic", {username: "group1", password: "test123"});
3350

3451
// Show implemented API version of the back-end
35-
var capabilities = await con.capabilities();
36-
console.log("Server API version: " +capabilities.version());
52+
var capabilities = con.capabilities();
53+
console.log("Server API version: " + capabilities.apiVersion());
3754

3855
// List collection names
3956
var collections = await con.listCollections();
40-
console.log("Collections: " +collections.collections.map(c => c.name));
57+
console.log("Collections: " + collections.collections.map(c => c.name));
4158

4259
// List process ids
4360
var processes = await con.listProcesses();
@@ -48,43 +65,31 @@ try {
4865
console.log("Files types: " + Object.keys(fileTypes.formats));
4966

5067
// Check whether synchronous previews are supported
51-
var syncSupport = capabilities.hasFeature("execute");
68+
var syncSupport = capabilities.hasFeature("computeResult");
5269
console.log("Synchronous previews: " + (syncSupport ? "supported" : "NOT supported"));
5370

5471
// Request a preview synchronously for a process graph
5572
if (syncSupport) {
56-
// Derives maximum NDVI measurements over pixel time series of Sentinel 2 imagery
57-
var processGraph = {
58-
"imagery": {
59-
"red": "B4",
60-
"nir": "B8",
61-
"imagery": {
62-
"extent": ["2018-12-01T00:00:00Z","2018-12-31T23:59:59Z"],
63-
"imagery": {
64-
"extent": {"west": 8.265169,"south": 52.453917,"east": 8.42035,"north": 52.576767},
65-
"imagery": {
66-
"process_id": "get_collection",
67-
"name": "COPERNICUS/S2"
68-
},
69-
"process_id": "filter_bbox"
70-
},
71-
"process_id": "filter_daterange"
72-
},
73-
"process_id": "NDVI"
74-
},
75-
"process_id": "max_time"
76-
};
77-
var preview = await con.execute(processGraph, "png");
73+
// Replace ... with your JSON process graph
74+
var preview = await con.computeResult(..., "png");
7875
// This returns a Blob object containing a binary PNG file you could further process or show.
7976
}
8077
} catch(e) {
8178
console.log(e);
8279
}
8380
```
8481

82+
More information can be found in the [**JS client documentation**](https://open-eo.github.io/openeo-js-client/0.4.0/).
83+
84+
## Roadmap
85+
86+
* The JS client only supports browsers with support for ECMAScript 2017 (ES8). This is a steep requirement and should be lowered by transpiling. [#18](https://github.com/Open-EO/openeo-js-client/issues/18)
87+
* There's no functionality to build process graphs. An easy-to-use process graph builder is envisioned to be implemented. [#19](https://github.com/Open-EO/openeo-js-client/issues/19)
88+
* Implement authentification via OpenID Connect. [#11](https://github.com/Open-EO/openeo-js-client/issues/11)
89+
* See the [issue tracker](https://github.com/Open-EO/openeo-js-client/issues) for more information.
90+
8591
## Interactive JS Editor
8692

8793
There is an experimental interactive web-based editor for coding using the openEO API,
88-
where you can define processes and visualizations in JavaScript.
94+
which is based on the JavaScript client.
8995
See [https://github.com/Open-EO/openeo-web-editor](https://github.com/Open-EO/openeo-web-editor) for more details.
90-

examples/discovery.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,21 @@
77
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
88
<script src="../openeo.js"></script>
99
<script type="text/javascript">
10-
var url = "https://earthengine.openeo.org/v0.3"; // Insert the openEO server URL here
10+
var url = "https://earthengine.openeo.org"; // Insert the openEO server URL here
1111
var connection = null;
1212

1313
window.onload = function () {
1414
document.getElementById('url').innerText = url;
1515

16-
var client = new OpenEO();
17-
document.getElementById('clientVersion').innerText = client.version();
16+
document.getElementById('clientVersion').innerText = OpenEO.clientVersion();
1817

19-
client.connect(url)
18+
OpenEO.connect(url)
2019
.then(c => {
2120
connection = c;
2221
return connection.capabilities();
2322
})
2423
.then(capabilities => {
25-
document.getElementById('serverVersion').innerText = capabilities.version();
24+
document.getElementById('serverVersion').innerText = capabilities.apiVersion();
2625
return connection.listCollections();
2726
})
2827
.then(collections => {

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module.exports = {
1313
"reporters": [
1414
"default",
1515
["./node_modules/jest-html-reporter", {
16-
"pageTitle": "Test Report for openeo-js-client"
16+
"pageTitle": "Test Report for openeo-js-client",
17+
"outputPath": "./coverage/test-report.html"
1718
}]
1819
]
1920

0 commit comments

Comments
 (0)