1
1
<!DOCTYPE html>
2
2
< html >
3
3
< head >
4
- < title > JS Client Test </ title >
4
+ < title > openEO JS client - Discovery example </ title >
5
5
< meta charset ="UTF-8 ">
6
6
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
7
< script src ="https://unpkg.com/axios/dist/axios.min.js "> </ script >
8
8
< script src ="../openeo.js "> </ script >
9
- < script src ="examples.js "> </ script >
10
- < script type ="text/javascript ">
11
- window . onload = function ( ) {
12
- OpenEO . API . baseUrl = "http://localhost/api" ;
13
- OpenEO . API . driver = 'openeo-r-backend' ;
14
-
15
- OpenEO . API . getCapabilities ( ) . then ( obj => {
16
- replaceWithList ( "capabilities" , obj . rawData ) ;
17
- } ) ;
18
-
19
- OpenEO . Data . get ( )
20
- . then ( data => {
21
- replaceWithList ( "data" , data ) ;
22
- } ) . catch ( function ( errorCode ) {
23
- replace ( "data" , "Request returned error " + errorCode ) ;
24
- } ) ;
9
+ < script type ="text/javascript ">
10
+ var url = "https://earthengine.openeo.org/v0.3" ; // Insert the openEO server URL here
11
+ var connection = null ;
25
12
26
- OpenEO . Data . getById ( 'landsat7_ndvi' )
27
- . then ( data => {
28
- replaceWithList ( "data_id" , data ) ;
29
- } ) . catch ( errorCode => {
30
- replace ( "data_id" , "Request returned error " + errorCode ) ;
31
- } ) ;
13
+ window . onload = function ( ) {
14
+ document . getElementById ( 'url' ) . innerText = url ;
32
15
33
- OpenEO . Processes . get ( "ndvi" )
34
- . then ( data => {
35
- replaceWithList ( "processes" , data ) ;
36
- } ) . catch ( errorCode => {
37
- replace ( "processes" , "Request returned error " + errorCode ) ;
38
- } ) ;
16
+ var client = new OpenEO ( ) ;
17
+ document . getElementById ( 'clientVersion' ) . innerText = client . version ( ) ;
39
18
40
- OpenEO . Processes . getById ( 'calculate_ndvi' )
41
- . then ( data => {
42
- replaceWithList ( "processes_id" , data ) ;
43
- } ) . catch ( errorCode => {
44
- replace ( "processes_id" , "Request returned error " + errorCode ) ;
45
- } ) ;
19
+ client . connect ( url )
20
+ . then ( c => {
21
+ connection = c ;
22
+ return connection . capabilities ( ) ;
23
+ } )
24
+ . then ( capabilities => {
25
+ document . getElementById ( 'serverVersion' ) . innerText = capabilities . version ( ) ;
26
+ return connection . listCollections ( ) ;
27
+ } )
28
+ . then ( collections => {
29
+ document . getElementById ( 'collectionCount' ) . innerText = collections . collections . length ;
30
+ return connection . listProcesses ( ) ;
31
+ } )
32
+ . then ( processes => {
33
+ document . getElementById ( 'processCount' ) . innerText = processes . processes . length ;
34
+ return ;
35
+ } )
36
+ . catch ( err => alert ( err . message ) ) ; ;
46
37
} ;
47
38
</ script >
48
39
</ head >
49
40
< body >
50
- < h2 > Capabilities</ h2 >
51
- < div id ="capabilities ">
52
- Loading data...
53
- </ div >
54
- < h2 > Data</ h2 >
55
- < div id ="data ">
56
- Loading data...
57
- </ div >
58
- < h2 > Data: Landsat NDVI</ h2 >
59
- < div id ="data_id ">
60
- Loading data...
61
- </ div >
62
- < h2 > Processes (containing ndvi)</ h2 >
63
- < div id ="processes ">
64
- Loading data...
65
- </ div >
66
- < h2 > Processes: calculate_ndvi</ h2 >
67
- < div id ="processes_id ">
68
- Loading data...
69
- </ div >
41
+ < h1 > Server information</ h1 >
42
+ < p > URL: < span id ="url "> </ span > </ p >
43
+ < h2 > Versions</ h2 >
44
+ < ul >
45
+ < li > Client Version: < span id ="clientVersion "> Loading...</ span > </ li >
46
+ < li > Server Version: < span id ="serverVersion "> Loading...</ span > </ li >
47
+ </ ul >
48
+ < h2 > EO Data Discovery</ h2 >
49
+ < p > Number of supported collections: < span id ="collectionCount "> Loading...</ span > </ p >
50
+ < h2 > Process Discovery</ h2 >
51
+ < p > Number of supported processes: < span id ="processCount "> Loading...</ span > </ p >
70
52
</ body >
71
- </ html >
53
+ </ html >
0 commit comments