Skip to content

Commit

Permalink
Add support for basemap api keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyankou committed Aug 16, 2023
1 parent 00213c3 commit 712bf65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var constants = {
_githubRepo: 'Author GitHub Repo Link',
// Map Settings
_tileProvider: 'Basemap Tiles',
_tileProviderApiKey: 'Basemap Tiles API Key',
_zoomControls: 'Zoom Controls',
_narrativeWidth: 'Narrative Width',
_imgContainerHeight: 'Media Container Height',
Expand Down
8 changes: 7 additions & 1 deletion scripts/storymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ $(window).on('load', function() {
function addBaseMap() {
var basemap = trySetting('_tileProvider', 'Stamen.TonerLite');
L.tileLayer.provider(basemap, {
maxZoom: 18
maxZoom: 18,

// Pass the api key to most commonly used parameters
apiKey: trySetting('_tileProviderApiKey', ''),
apikey: trySetting('_tileProviderApiKey', ''),
key: trySetting('_tileProviderApiKey', ''),
accessToken: trySetting('_tileProviderApiKey', '')
}).addTo(map);
}

Expand Down

0 comments on commit 712bf65

Please sign in to comment.