DroneDeploy
Search…
Annotations.get
1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
<meta charset="UTF-8">
6
<title>Document</title>
7
<style>
8
.title {
9
font-size: 1.3em;
10
font-weight: 500;
11
}
12
13
.annotation {
14
border-top: 1px dashed #333;
15
padding-bottom: 10px;
16
}
17
18
.ann-title {
19
font-size: 1.2em;
20
font-weight: 500;
21
}
22
23
.subtitle {
24
font-weight: 300;
25
}
26
27
.sans {
28
font-family: Lato, sans-serif;
29
color: rgba(0, 0, 0, 0.87);
30
}
31
</style>
32
</head>
33
34
<body>
35
<h1 class="title sans">Annotation.get Example</h1>
36
<div id="annotation-details"></div>
37
<script>
38
var annotationDetails = document.getElementById('annotation-details');
39
40
function formatOutput(annotation, i) {
41
//es6 template string
42
return `
43
<div class="annotation">
44
<h2 class="ann-title sans">Annotation ${i + 1}</h2>
45
${annotation.geometry.lat && annotation.geometry.lng ?
46
'<div class="coordinates"><span class="subtitle sans">Coordinates:</span> ' + annotation.geometry.lat + ',' + annotation.geometry.lng + '</div>'
47
:
48
''
49
}
50
<div class="type"><span class="subtitle sans">Type:</span> ${annotation.type}</div>
51
<div class="description"><span class="subtitle sans">Date Created:</span> ${new Date(annotation.dateCreation).toDateString()}</div>
52
</div>
53
`
54
}
55
56
new DroneDeploy({
57
version: 1
58
})
59
.then(function(dronedeployApi) {
60
return dronedeployApi.Plans.getCurrentlyViewed()
61
.then(function(plan) {
62
return dronedeployApi.Annotations.get(plan.id, {
63
comments: true
64
})
65
})
66
})
67
.then(function(annotations) {
68
annotationDetails.innerHTML = annotations.map(formatOutput).join('');
69
});
70
</script>
71
</body>
72
73
</html>
Copied!
Last modified 2yr ago
Copy link