-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrouting.js
More file actions
62 lines (49 loc) · 1.52 KB
/
routing.js
File metadata and controls
62 lines (49 loc) · 1.52 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function uploadCustomRoute(){
let url = `https://fleet.ls.hereapi.com/2/overlays/upload.json`+
`?apikey=${window.hereCreds.JS_KEY}`+
`&map_name=OVERLAYIKEA`+
`&overlay_spec=[{
"op":"create",
"shape":[
[52.46959,13.36809],
[52.46959,13.36801],
[52.46960,13.36792],
[52.46960,13.36781],
[52.46960,13.36771],
[52.46961,13.36761],
[52.46961,13.36751],
[52.46962,13.36741],
[52.46962,13.36732]],
"data":{"NAMES":"IKEA loading Road","TRAVEL_DIRECTION":"B"}
}]`+
`&storage=readonly`;
fetch(url)
.then(response => response.json())
.then(response => {
console.log(response);
}, error =>{
console.error(error);
});
}
function drawCustomRoute(){
let points = [
{lat:52.46959,lng:13.36809},
{lat:52.46959,lng:13.36801},
{lat:52.46960,lng:13.36792},
{lat:52.46960,lng:13.36781},
{lat:52.46960,lng:13.36771},
{lat:52.46961,lng:13.36761},
{lat:52.46961,lng:13.36751},
{lat:52.46962,lng:13.36741},
{lat:52.46962,lng:13.36732}];
var linestring = new H.geo.LineString();
points.forEach(function(point) {
linestring.pushPoint(point);
});
// Initialize a polyline with the linestring:
var polyline = new H.map.Polyline(linestring, { style: { strokeColor: "rgba(255,0,0,0.5)", lineWidth: 6 }});
// Add the polyline to the map:
map.addObject(polyline);
};
drawCustomRoute();
uploadCustomRoute();