diff --git a/examples/measure/index.pug b/examples/measure/index.pug index 0f451f50a5..d6af56cddc 100644 --- a/examples/measure/index.pug +++ b/examples/measure/index.pug @@ -6,15 +6,7 @@ block append mainContent .form-group label(for='basemap') Base map select#basemap(param-name='basemap', placeholder='stamen-toner-lite') - option(value='stamen-toner-lite') Stamen Toner Lite - option(value='osm') OpenStreetMap - option(value='nationalmap-satellite') National Map Satellite - option(value='stamen-terrain') Stamen Terrain - option(value='stamen-terrain-background') Stamen Terrain Background - option(value='stamen-toner') Stamen Toner - option(value='wikimedia') Wikimedia option(value='custom') Custom - option(value='false') None button#hide(title='Hide the control panel') Hide input#mapurl.hidden(param-name='mapurl') .form-group.annotationtype(title='Select the type of annotation to add.') diff --git a/examples/measure/main.js b/examples/measure/main.js index 69c30da3db..691fd53157 100644 --- a/examples/measure/main.js +++ b/examples/measure/main.js @@ -47,9 +47,19 @@ if (query.extra) { // Add a blank tile for removing the map geo.osmLayer.tileSources['false'] = { url: '/data/white.jpg', - attribution: '' + attribution: '', + name: 'None' }; +// Fill select drop down +var options = geo.osmLayer.tileSources; +for (const option in options) { + var newOption = document.createElement('option'); + newOption.value = option; + newOption.text = options[option].name ? options[option].name : option; + document.getElementById('basemap').appendChild(newOption); +} + var map, mapLayer, layer, fromButtonSelect, fromGeojsonUpdate; // Set controls based on query parameters diff --git a/src/osmLayer.js b/src/osmLayer.js index 22a4757c09..de04a6e556 100644 --- a/src/osmLayer.js +++ b/src/osmLayer.js @@ -131,6 +131,9 @@ let StamenAttribution = 'Map tiles by Stamen ' + 'CC BY 3.0. Data by OpenStreetMap' + ', under ODbL.'; +/* Per Carto's website regarding basemap attribution: https://carto.com/help/working-with-data/attribution/#basemaps */ +let CartoAttribution = ' Carto ' + 'Contributors OpenStreetMap'; + /** * This is a list of known tile sources. It can be added to via * `geo.osmLayer.tilesource[] = `, where the object has `url`, @@ -139,9 +142,24 @@ let StamenAttribution = 'Map tiles by Stamen ' + * @type {object} */ osmLayer.tileSources = { + 'dark-matter-with-labels': { + url: ' https://{s}.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png', + attribution: CartoAttribution, + name: 'Carto Dark Matter With Labels', + minLevel: 0, + maxLevel: 18 + }, + 'dark-matter-without-labels': { + url: 'https://{s}.basemaps.cartocdn.com/rastertiles/dark_nolabels/{z}/{x}/{y}.png', + attribution: CartoAttribution, + name: 'Carto Dark Matter Without Labels', + minLevel: 0, + maxLevel: 18 + }, 'nationalmap-satellite': { url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}', attribution: 'Tile data from USGS', + name:'National Map Satellite', minLevel: 0, maxLevel: 16 }, @@ -149,13 +167,29 @@ osmLayer.tileSources = { url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', attribution: 'Tile data © ' + 'OpenStreetMap contributors', + name:'OpenStreetMap', subdomains: 'abc', minLevel: 0, maxLevel: 19 }, + 'positron-with-labels': { + url: 'https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', + attribution: CartoAttribution, + name:'Carto Positron With Labels', + minLevel: 0, + maxLevel: 18 + }, + 'positron-without-labels': { + url: 'https://{s}.basemaps.cartocdn.com/rastertiles/light_nolabels/{z}/{x}/{y}.png', + attribution: CartoAttribution, + name:'Carto Positron Without Labels', + minLevel: 0, + maxLevel: 18 + }, 'stamen-terrain': { url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png', attribution: StamenAttribution, + name:'Stamen Terrain', subdomains: 'abcd', minLevel: 0, maxLevel: 14 @@ -163,6 +197,7 @@ osmLayer.tileSources = { 'stamen-terrain-background': { url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}.png', attribution: StamenAttribution, + name:'Stamen Terrain Background', subdomains: 'abcd', minLevel: 0, maxLevel: 14 @@ -170,6 +205,7 @@ osmLayer.tileSources = { 'stamen-toner': { url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png', attribution: StamenAttribution, + name:'Stamen Toner', subdomains: 'abcd', minLevel: 0, maxLevel: 20 @@ -177,13 +213,29 @@ osmLayer.tileSources = { 'stamen-toner-lite': { url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.png', attribution: StamenAttribution, + name:'Stamen Toner Lite', subdomains: 'abcd', minLevel: 0, maxLevel: 20 }, + 'voyager-with-labels': { + url: 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png', + attribution: CartoAttribution, + name:'Carto Voyager With Labels', + minLevel: 0, + maxLevel: 18 + }, + 'voyager-without-layers': { + url: 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png', + attribution: CartoAttribution, + name:'Carto Voyager Without Layers', + minLevel: 0, + maxLevel: 18 + }, 'wikimedia': { url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', attribution: 'Wikimedia maps | Map data © OpenStreetMap contributors', + name:'Wikimedia', minLevel: 0, maxLevel: 19 }