in source/console/src/app/secure/maps/maps.component.ts [74:128]
createMap() {
const _self = this;
if (_self.profile.mapboxToken === 'NA' || _self.profile.mapboxToken === '') {
_self.invalidMapboxToken = true;
return;
}
mapboxgl.accessToken = _self.profile.mapboxToken;
_self.map = new mapboxgl.Map({
container: 'map', // container id
style: 'mapbox://styles/mapbox/bright-v9', // stylesheet location
center: [_self.gps.longitude, _self.gps.latitude], // starting position [lng, lat]
zoom: 14 // starting zoom
});
_self.map.on('error', function(err: any) {
_self.logger.error('mapbox gl error');
_self.logger.error(err);
_self.invalidMapboxToken = true;
return;
});
_self.map.on('load', function() {
_self.map.addSource('sourceTest', {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: [_self.gps.longitude, _self.gps.latitude]
}
}
]
}
});
_self.map.addLayer({
id: 'layerTest',
source: 'sourceTest',
type: 'circle',
paint: {
'circle-radius': 10,
'circle-color': '#1de9b6',
'circle-opacity': 0.7,
'circle-stroke-width': 2,
'circle-stroke-color': '#00897b'
}
});
});
}