1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "plots": [
12 {
13 "plotId": "demo-flagged-frontier",
14 "commodity": "coffee",
15 "geometry": {
16 "type": "Polygon",
17 "coordinates": [
18 [
19 [
20 -45.2523,
21 -13.0336
22 ],
23 [
24 -45.2477,
25 -13.0336
26 ],
27 [
28 -45.2477,
29 -13.029
30 ],
31 [
32 -45.2523,
33 -13.029
34 ],
35 [
36 -45.2523,
37 -13.0336
38 ]
39 ]
40 ]
41 }
42 },
43 {
44 "plotId": "demo-clear-reference",
45 "commodity": "coffee",
46 "geometry": {
47 "type": "Polygon",
48 "coordinates": [
49 [
50 [
51 -45.6023,
52 -12.9523
53 ],
54 [
55 -45.5977,
56 -12.9523
57 ],
58 [
59 -45.5977,
60 -12.9477
61 ],
62 [
63 -45.6023,
64 -12.9477
65 ],
66 [
67 -45.6023,
68 -12.9523
69 ]
70 ]
71 ]
72 }
73 },
74 {
75 "plotId": "demo-sliver-qc",
76 "commodity": "coffee",
77 "wkt": "POLYGON((-45.00019 -12.75028, -45.00001 -12.75028, -45.00001 -12.7501, -45.00019 -12.7501, -45.00019 -12.75028))"
78 }
79 ],
80 "cutoffDate": "2020-12-31",
81 "layers": [
82 "hansen_gfc",
83 "jrc_tmf"
84 ],
85 "maxTilesPerRun": 4,
86 "maxCacheEntries": 300
87};
88
89
90const run = await client.actor("atlas-data/eudr-deforestation-risk-screener").call(input);
91
92
93console.log('Results from dataset');
94console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
95const { items } = await client.dataset(run.defaultDatasetId).listItems();
96items.forEach((item) => {
97 console.dir(item);
98});
99
100