-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtransit.js
More file actions
31 lines (22 loc) · 802 Bytes
/
transit.js
File metadata and controls
31 lines (22 loc) · 802 Bytes
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
function getTransitRoute() {
let url = "https://transit.router.hereapi.com/v8/stations" +
"?apiKey=YOUR_API_KEY" +
"&in=51.50808,-0.07587";
fetch(url)
.then(response => response.json())
.then(response => {
console.log(response);
let markerGroup = new H.map.Group();
response.stations.forEach(station => {
let marker = new H.map.Marker(station.place.location);
markerGroup.addObject(marker);
});
map.addObject(markerGroup);
map.getViewModel().setLookAtData({
bounds: markerGroup.getBoundingBox()
});
}, error => {
console.log.error(error);
});
}
getTransitRoute();