-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.js
48 lines (36 loc) · 1.29 KB
/
debug.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
var mapboxgl = require('mapbox-gl');
var insertCss = require('insert-css');
var fs = require('fs');
mapboxgl.accessToken = window.localStorage.getItem('MapboxAccessToken');
insertCss(fs.readFileSync('./node_modules/mapbox-gl/dist/mapbox-gl.css', 'utf8'));
insertCss(fs.readFileSync('dist/mapbox-gl-nsw-rfs-majorincidents.css', 'utf8'));
function addCss(fileName) {
var head = document.head
var link = document.createElement("link")
link.type = "text/css"
link.rel = "stylesheet"
link.href = fileName
head.appendChild(link)
}
addCss('./node_modules/bootstrap/dist/css/bootstrap.min.css');
addCss('./node_modules/font-awesome/css/font-awesome.min.css');
addCss('./node_modules/osmic/font/osmic.css');
var MapboxGLNSWRFSMajorIncidents = require('./');
var mapDiv = document.body.appendChild(document.createElement('div'));
mapDiv.style.position = 'absolute';
mapDiv.style.top = 0;
mapDiv.style.right = 0;
mapDiv.style.left = 0;
mapDiv.style.bottom = 0;
var map = new mapboxgl.Map({
container: mapDiv,
style: 'mapbox://styles/mapbox/streets-v9',
center: [147, -33],
zoom: 5,
hash: true
});
window.map = map;
var nswRFSMajorIncidents = new MapboxGLNSWRFSMajorIncidents();
window.nswRFSMajorIncidents = nswRFSMajorIncidents;
map.addControl(nswRFSMajorIncidents);