-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathelevation.html
43 lines (40 loc) · 1.13 KB
/
elevation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang='en'>
<head>
<title>ORS-js lib examples</title>
<script type='module' src='../dist/ors-js-client.js'></script>
</head>
<body>
<div>
<h1>ORS-js lib examples</h1>
<section>
<h2>Elevation</h2>
<div id='elevation'>
<script type='module'>
import apiKey from './apiKey.js'
import { prettifyJson } from './utils.js'
window.onload = async function() {
const node = document.getElementById('elevation')
const Elevation = new Openrouteservice.Elevation({
api_key: apiKey
})
try {
const json = await Elevation.lineElevation({
format_in: 'encodedpolyline',
geometry: 'u`rgFswjpAKD'
})
console.log(json)
let response = prettifyJson(json)
node.innerHTML = '<h3>Response</h3><p>' + response + '</p>'
} catch (err) {
console.error(err)
let response = prettifyJson(err)
node.innerHTML = '<h3>Response</h3><p>' + response + '</p>'
}
}
</script>
</div>
</section>
</div>
</body>
</html>