forked from alletsz/devrel-workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.js
More file actions
46 lines (41 loc) · 1.11 KB
/
map.js
File metadata and controls
46 lines (41 loc) · 1.11 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
class HereMap {
constructor(mapElement) {
this.platform = new H.service.Platform({
'apikey': config.apiKey
});
this.map = new H.Map(
mapElement,
this.platform.createDefaultLayers().vector.normal.map,
{
zoom: 18,
center: { lat: '47.62047340703363', lng: '-122.34904917756407' }
}
);
const mapEvent = new H.mapevents.MapEvents(this.map);
const behavior = new H.mapevents.Behavior(mapEvent);
this.geofencing = this.platform.getGeofencingService();
this.currentPosition = new H.map.Marker({ lat: 37.21, lng: -121.21 });
this.map.addObject(this.currentPosition);
}
draw(mapObject) {
this.map.addObject(mapObject);
}
// returns list of uploaded layers
getLayers() {
let fleetURL = "https://fleet.ls.hereapi.com/2/layers/list.json"
return axios({
method: 'get',
url: fleetURL,
params: {
apiKey: config.apiKey
}
})
.then( response => {
return response.data.layers
})
.catch( error => {
console.log(error);
return Promise.reject(error)
})
}
}