Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
// Since we are creating a new map instance, the code below within componentDidMount can only be run once. So, the code needs to remain here, and can't be in the MapContainer file (since each change in state would re-run the code).
L.mapbox.accessToken = 'pk.eyJ1IjoiYWRhbTIyMjIiLCJhIjoiY2l5dGJhaW96MDAwcDJ3bzM0MXk2aTB0bSJ9.kgHNRDiGEmq12toljp2-kA'
var map = L.mapbox.map('map').setView([16.541430, 7.558594], 3);
// map.setMaxBounds([
// [83, 190],
// [-83, -210]
// ])
this.map = map;
// Use styleLayer to add a Mapbox style created in Mapbox Studio
L.mapbox.styleLayer('mapbox://styles/adam2222/ciyucouor002e2rpl7gut7p81').addTo(map);
// map.dragging.disable();
// map.touchZoom.disable();
// map.doubleClickZoom.disable();
// map.scrollWheelZoom.disable();
// map.zoomControl.remove();
componentDidMount() {
// Since we are creating a new map instance, the code below within componentDidMount can only be run once. So, the code needs to remain here, and can't be in the MapContainer file (since each change in state would re-run the code).
L.mapbox.accessToken = 'pk.eyJ1IjoiYWRhbTIyMjIiLCJhIjoiY2l5dGJhaW96MDAwcDJ3bzM0MXk2aTB0bSJ9.kgHNRDiGEmq12toljp2-kA'
var map = L.mapbox.map('map').setView([16.541430, 7.558594], 3);
// map.setMaxBounds([
// [83, 190],
// [-83, -210]
// ])
this.map = map;
// Use styleLayer to add a Mapbox style created in Mapbox Studio
L.mapbox.styleLayer('mapbox://styles/adam2222/ciyucouor002e2rpl7gut7p81').addTo(map);
// map.dragging.disable();
// map.touchZoom.disable();
// map.doubleClickZoom.disable();
// map.scrollWheelZoom.disable();
// map.zoomControl.remove();
// [83, 190],
// [-83, -210]
// ])
this.map = map;
// Use styleLayer to add a Mapbox style created in Mapbox Studio
L.mapbox.styleLayer('mapbox://styles/adam2222/ciyucouor002e2rpl7gut7p81').addTo(map);
// map.dragging.disable();
// map.touchZoom.disable();
// map.doubleClickZoom.disable();
// map.scrollWheelZoom.disable();
// map.zoomControl.remove();
geojson = L.geoJSON(countriesLayer, {
onEachFeature: this.countriesOnEachFeature
}).addTo(map);
geojson.setStyle({opacity: 0, fillOpacity: 0})
// Map click function to show coordinates of the place when the mpa is clicked
// Don't erase this function, we might need this for future modification
//Need to change below click event when refactoring into react component
// map.on('click', onMapClick);
//Add country markers
const clear = this._clearEl = document.createElement('button');
clear.classList.add('geocoder-icon', 'geocoder-icon-close');
clear.addEventListener('click', this._clear.bind(this));
const loading = this._loadingEl = document.createElement('span');
loading.classList.add('geocoder-icon', 'geocoder-icon-loading');
actions.appendChild(clear);
actions.appendChild(loading);
el.appendChild(icon);
el.appendChild(input);
el.appendChild(actions);
this.container.appendChild(el);
this.client = new MapboxClient(this.options.accessToken ?
this.options.accessToken :
mapboxgl.accessToken);
// Override the control being added to control containers
if (this.options.container) this.options.position = false;
this._typeahead = new Typeahead(input, []);
this._typeahead.getItemValue = function(item) { return item.place_name; };
return el;
}
(function() {
global.jQuery = require('jquery');
global.$ = global.jQuery;
require('bootstrap');
var _ = require('underscore');
var mu = require('./src/measure_utils');
var config = require('./src/config');
var Highcharts = require('Highcharts');
var chartOptions = require('./src/highcharts-options');
var L = require('mapbox.js');
var Handlebars = require('handlebars');
Highcharts.setOptions({
global: {useUTC: false}
});
L.mapbox.accessToken = 'pk.eyJ1IjoiYW5uYXBvd2VsbHNta' +
'XRoIiwiYSI6ImNzY1VpYkkifQ.LC_IcHpHfOvWOQCuo5t7Hw';
var measures = {
el: {
chart: '#charts .chart',
charts: '#charts',
mapPanel: 'map-measure',
perfSummary: '#perfsummary',
showAll: '#showall',
sortButtons: ".btn-group > .btn",
summaryTemplate: '#summary-panel',
panelTemplate: "#measure-panel"
},
setUp: function() {
var _this = this;
setUpMap: function(options) {
var _this = this;
if ($('#' + _this.el.mapPanel).length) {
var maxZoom = _this.zoomLevelForOrgType(options.orgType);
var map = L.mapbox.map(
_this.el.mapPanel,
'mapbox.streets',
{zoomControl: false}).setView([52.905, -1.79], maxZoom);
map.scrollWheelZoom.disable();
var layer = L.mapbox.featureLayer()
.loadURL(options['orgLocationUrl'])
.on('ready', function() {
if (layer.getBounds().isValid()) {
map.fitBounds(layer.getBounds(), {maxZoom: maxZoom});
layer.setStyle({fillColor: '#ff00ff',
fillOpacity: 0.2,
weight: 0.5,
color: '#333',
radius: 10});
} else {
$('#map-container').html('');
}
})
.addTo(map);
}
},
module.exports = function (state, options) {
L.Icon.Default.imagePath = 'node_modules/leaflet/dist/images/'
L.mapbox.accessToken = options.mapboxToken
var tileLayer = L.mapbox.tileLayer(options.tileLayer)
var map = L.map(options.el, {
center: state.map.center,
zoom: state.map.zoom,
zoomControl: false,
layers: [tileLayer],
attributionControl: false
})
state.on('resize', function () {
map.setZoom(state.map.zoom)
map.setView(state.map.center)
})
var location = L.marker([47, -122], {
var map = L.map(options.el, {
center: state.map.center,
zoom: state.map.zoom,
zoomControl: false,
layers: [tileLayer],
attributionControl: false
})
state.on('resize', function () {
map.setZoom(state.map.zoom)
map.setView(state.map.center)
})
var location = L.marker([47, -122], {
icon: L.mapbox.marker.icon({
'marker-size': 'small',
'marker-color': '#fa0'
})
}).addTo(map)
movement.on('data', function (data) {
location.setLatLng(new L.LatLng(data.coords.latitude, data.coords.longitude))
})
new L.Control.Zoom({ position: 'topright' }).addTo(map)
function attributionPosition (position) {
new L.control.attribution({ position: state.attribution })
.setPrefix('')
.addAttribution('<a href="https://www.mapbox.com/about/maps/">© Mapbox</a>')
.addAttribution('<a href="https://www.openstreetmap.org/about">© OpenStreetMap</a>')
var $ = require('jquery');
var _ = require('underscore');
var mu = require('./measure_utils');
var utils = require('./chart_utils');
var domready = require('domready');
var Highcharts = require('Highcharts');
var chartOptions = require('./highcharts-options');
var L = require('mapbox.js');
var Handlebars = require('handlebars');
var config = require('./config');
Highcharts.setOptions({
global: {useUTC: false},
});
L.mapbox.accessToken = window.MAPBOX_PUBLIC_TOKEN;
var measures = {
el: {
chart: '#charts .chart',
charts: '#charts',
mapPanel: 'map-measure',
perfSummary: '#perfsummary',
showAll: '.showall',
sortButtons: '.btn-group > .btn',
summaryTemplate: '#summary-panel',
panelTemplate: '#measure-panel',
noCostSavingWarning: '#no-cost-saving-warning'
},
setUp: function() {
var _this = this;
setUpMap: function(options) {
var _this = this;
if ($('#' + _this.el.mapPanel).length) {
var map = L.mapbox.map(_this.el.mapPanel,
'mapbox.streets').setView([52.905, -1.79], 6);
map.scrollWheelZoom.disable();
var url = config.apiHost + '/api/1.0/org_location/?org_type=' +
options.orgType.toLowerCase();
url += '&q=' + options.orgId;
var layer = L.mapbox.featureLayer()
.loadURL(url)
.on('ready', function() {
if (layer.getBounds().isValid()) {
map.fitBounds(layer.getBounds(), {maxZoom: 12});
layer.setStyle({fillColor: '#ff00ff',
fillOpacity: 0.2,
weight: 0.5,
color: "#333",
radius: 10});
} else {
$('#map-container').html('');
}
})
.addTo(map);
}
},