-
Notifications
You must be signed in to change notification settings - Fork 7
/
map.js
29 lines (25 loc) · 936 Bytes
/
map.js
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
// Initialize platform with JS API KEY
var platform = new H.service.Platform({
apikey: "YOUR_JS_API_KEY"
});
// initializing default layers for the map
var defaultLayers = platform.createDefaultLayers();
// rendering map within the container on the page
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.vector.normal.map, // rendering vector map with NORMAL map view.
{
zoom: 11, // Initial zoom level of map
center: {lat: 52.53086, lng: 13.38474} // Initial center of map
});
// creating default UI for map
var ui = H.ui.UI.createDefault(map, defaultLayers);
// Add basic map events like pan and zoom
var mapEvents = new H.mapevents.MapEvents(map);
// Initialize for map behaviour on events
var behavior = new H.mapevents.Behavior(mapEvents);
// adjust tilt and rotation of the map
map.getViewModel().setLookAtData({
tilt: 60,
heading: 90
});