Is it possible to use a "Custom TiledMapServiceLayer" as a Basemap? Is it possible to show a "Custom TiledMapServiceLayer" in BasemapGallery?
1 Answer
Yes definitely, your basemaps.js file would look something like the following:
define([
'esri/dijit/Basemap',
'esri/dijit/BasemapLayer',
'esri/layers/osm'
], function ( Basemap, BasemapLayer, osm ) {
return {
map: true, // needs a reference to the map
mode: 'custom', //must be either 'agol' or 'custom'
title: 'Basemaps', // title for widget
mapStartBasemap: 'topo', // must match one of the basemap keys below
//basemaps to show in menu. define in basemaps object below and reference by name here
// TODO Is this array necessary when the same keys are explicitly included/excluded below?
basemapsToShow: ['topo', 'aerial'],
// define all valid custom basemaps here. Object of Basemap objects. For custom basemaps, the key name and basemap id must match.
basemaps: { // agol basemaps
topo: {
title: 'Map',
basemap: new Basemap({
id: 'topo',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer',
opacity: 0.5
})]
})
},