forked from alletsz/devrel-workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdispGeofences.js
More file actions
30 lines (21 loc) · 740 Bytes
/
dispGeofences.js
File metadata and controls
30 lines (21 loc) · 740 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
function displayGeofences(){
let geofenceURL ='https://YOUR_GEOFENCE_ENDPOINT.amazonaws.com/Prod/search/all.json'
let layer_id = 'SHOES';
let url = `${geofenceURL}?layer_id=${layer_id}`;
fetch(url)
.then(response=>response.json())
.then(response=>{
response.geometries.forEach(element => {
let shape = H.util.wkt.toGeometry(element.geometry);
geofences.addObject(new H.map.Polygon(shape));
});
map.getViewModel().setLookAtData({
bounds: geofences.getBoundingBox(),
zoom:18,
tilt: 40,
heading:190
});
})
.catch(error=>console.log(error))
}
displayGeofences();