File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424
2525 < script >
2626 mapboxgl . accessToken = 'pk.eyJ1IjoidG9tdmFuYXJtYW4iLCJhIjoiRDlFeWFVdyJ9.B6ZgpP0CsDlAF1D1emvosg' ;
27- var STYLE_URL = 'mapbox ://styles/tomvanarman/cmdlugpsh003401s93pou1z8m' ;
27+ var STYLE_URL = 'https ://api.mapbox.com/ styles/v1/ tomvanarman/cmdlugpsh003401s93pou1z8m?access_token=pk.eyJ1IjoidG9tdmFuYXJtYW4iLCJhIjoiRDlFeWFVdyJ9.B6ZgpP0CsDlAF1D1emvosg ' ;
2828 var GEOJSON_URL = 'CCTV-Cameras.geojson' ;
2929
3030 var map = new mapboxgl . Map ( {
3838 map . addControl ( new mapboxgl . NavigationControl ( { visualizePitch : true } ) , 'top-right' ) ;
3939 map . addControl ( new mapboxgl . FullscreenControl ( ) , 'top-right' ) ;
4040 map . addControl ( new mapboxgl . ScaleControl ( { maxWidth : 160 , unit : 'metric' } ) ) ;
41+
4142
4243 // Load GeoJSON first so we have it ready when the map's style is loaded
4344 var dataPromise = fetch ( GEOJSON_URL ) . then ( function ( r ) {
4445 if ( ! r . ok ) throw new Error ( 'Failed to load ' + GEOJSON_URL + ' (' + r . status + ')' ) ;
4546 return r . json ( ) ;
4647 } ) ;
48+
49+ map . on ( 'error' , function ( e ) { console . error ( 'Mapbox error:' , e && e . error ) ; } ) ;
4750
4851 map . on ( 'load' , function ( ) {
4952 dataPromise . then ( function ( geojson ) {
You can’t perform that action at this time.
0 commit comments