Skip to content

Instantly share code, notes, and snippets.

@kflaw
Created November 5, 2014 18:55
Show Gist options
  • Save kflaw/3e8422a5fdf89c8b95cc to your computer and use it in GitHub Desktop.
Save kflaw/3e8422a5fdf89c8b95cc to your computer and use it in GitHub Desktop.
basemap.js - cmv config
define([
'esri/dijit/Basemap',
'esri/dijit/BasemapLayer',
'esri/layers/osm'
], function ( Basemap, BasemapLayer, osm ) {
return {
map: true, // needs a refrence to the map
mode: 'custom', //must be either 'agol' or 'custom'
title: 'Basemaps', // tilte for widget
mapStartBasemap: 'hybridEsri', // 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: [ 'hybridEsri','satellite', 'streets', 'topo', 'lightGray'],
// define all valid custom basemaps here. Object of Basemap objects. For custom basemaps, the key name and basemap id must match.
basemaps: {
topo: {
title: 'Topo',
basemap: new Basemap({
id: 'topo',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer'
})]
})
},
streets: {
title: 'Streets',
basemap: new Basemap({
id: 'streets',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer'
})]
})
},
satellite: {
title: 'Satellite',
basemap: new Basemap({
id: 'satellite',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer'
})]
})
},
hybridEsri: {
title: 'Hybrid',
basemap: new Basemap({
id: 'hybridEsri',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
}), new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer',
isReference: true,
//displayLevels: [0, 1, 2, 3, 4, 5, 6, 7]
}), new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer',
isReference: false,
displayLevels: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
})]
})
},
lightGray: {
title: 'Light Gray Canvas',
basemap: new Basemap({
id: 'lightGray',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer'
}), new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer',
isReference: false
})]
})
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment