Skip to content

Commit

Permalink
updated configuration with examples of combined agol and custom basemaps
Browse files Browse the repository at this point in the history
Basemap and BasemapLayer dijits no longer needed for custom basemaps
some of the examples required v 3.16 or higher of the ESRI JavaScript API
  • Loading branch information
tmcgee committed Mar 20, 2016
1 parent ac12c93 commit 25a3893
Showing 1 changed file with 186 additions and 195 deletions.
381 changes: 186 additions & 195 deletions viewer/js/config/basemaps.js
Original file line number Diff line number Diff line change
@@ -1,204 +1,195 @@
define([
//'esri/dijit/Basemap',
//'esri/dijit/BasemapLayer',
//'esri/layers/osm'
], function (/* Basemap, BasemapLayer, osm */) {
'use strict';
define({
map: true, // needs a refrence to the map
title: 'Basemaps', // title for widget

return {
map: true, // needs a refrence to the map
mode: 'agol', //must be either 'agol' or 'custom'
title: 'Basemaps', // title for widget
/* optional starting basemap
/ otherwise uses the basemap from the map
/ must match one of the keys in basemaps object below
*/
//mapStartBasemap: 'streets',

/* optional starting basemap
/ otherwise uses the basemap from the map
/ must match one of the keys in basemaps object below
*/
//mapStartBasemap: 'streets',

/* optional array of basemaps to show in menu.
/ otherwise uses keys in basemaps object below
/ values in array must match keys in basemaps object
*/
//basemapsToShow: ['streets', 'satellite', 'hybrid', 'topo', 'lightGray', 'gray', 'national-geographic', 'osm', 'oceans'],
/* optional array of basemaps to show in menu.
/ otherwise uses keys in basemaps object below
/ values in array must match keys in basemaps object
*/
//basemapsToShow: ['streets', 'satellite', 'hybrid', 'topo', 'lightGray', 'gray', 'national-geographic', 'osm', 'oceans'],

// define all valid custom basemaps here. Object of Basemap objects. For custom basemaps, the key name and basemap id must match.
basemaps: { // agol basemaps
streets: {
title: 'Streets'
},
satellite: {
title: 'Satellite'
},
hybrid: {
title: 'Hybrid'
},
topo: {
title: 'Topo'
},
gray: {
title: 'Gray'
},
oceans: {
title: 'Oceans'
},
'national-geographic': {
title: 'Nat Geo'
},
osm: {
title: 'Open Street Map'
// define all valid basemaps here.
basemaps: {
streets: {
title: 'Streets'
},
'streets-night-vector': { // requires v3.16 or higher
title: 'Streets (Night)'
},
'streets-navigation-vector': { // requires v3.16 or higher
title: 'Streets (Navigation)'
},
'streets-relief-vector': { // requires v3.16 or higher
title: 'Street (Relief)'
},
satellite: {
title: 'Satellite'
},
hybrid: {
title: 'Hybrid'
},
topo: {
title: 'Topo'
},
'terrain': {
title: 'Terrain'
},
'gray-vector': { // requires v3.16 or higher
title: 'Gray'
},
'dark-gray-vector': { // requires v3.16 or higher
title: 'Dark Gray'
},
oceans: {
title: 'Oceans'
},
'national-geographic': {
title: 'Nat Geo'
},
osm: {
title: 'Open Street Map'
},
LandsatShaded: {
title: 'Landsat Shaded',
basemap: {
baseMapLayers: [
{
url: 'https://imagery.arcgisonline.com/arcgis/rest/services/LandsatGLS/LandsatShadedBasemap/ImageServer'
}
]
}
},
EarthAtNight: {
title: 'Earth at Night',
basemap: {
baseMapLayers: [
{
url: 'https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Earth_at_Night_WM/MapServer'
}
]
}
},
DavidRumseyMap1812: {
title: 'David Rumsey 1812',
basemap: {
baseMapLayers: [
{
url: 'http://tiles.arcgis.com/tiles/IEuSomXfi6iB7a25/arcgis/rest/services/World_Globe_1812/MapServer'
}
]
}
}

// examples of custom basemaps

/*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'
})]
})
},
hybrid: {
title: 'Hybrid',
basemap: new Basemap({
id: 'hybrid',
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: true,
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',
// additional examples of vector tile basemaps (requires v3.16 or higher)
/*
streetsVector: {
title: 'Streets',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/3b8814f6ddbd485cae67e8018992246e/resources/styles/root.json',
type: 'VectorTile'
}
]
}
},
satelliteVector: {
title: 'Satellite',
basemap: {
baseMapLayers: [
{
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
}
]
}
},
hybridVector: {
title: 'Hybrid',
basemap: {
baseMapLayers: [
{
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
},
{
url: 'https://www.arcgis.com/sharing/rest/content/items/1854498c7e35420b963a514a32689c80/resources/styles/root.json',
type: 'VectorTile',
isReference: true
})]
})
}*/

// example using vector tile basemaps (beta in v3.15)

/*
streets: {
title: 'Streets',
basemap: new Basemap({
id: 'streets',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/3b8814f6ddbd485cae67e8018992246e/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
},
satellite: {
title: 'Satellite',
basemap: new Basemap({
id: 'satellite',
layers: [new BasemapLayer({
url: '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
})]
})
},
hybrid: {
title: 'Hybrid',
basemap: new Basemap({
id: 'hybrid',
layers: [
new BasemapLayer({
url: '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
}),
new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/1854498c7e35420b963a514a32689c80/resources/styles/root.json',
'type': 'VectorTileLayer',
isReference: true
})
]
})
},
lightGray: {
title: 'Light Gray Canvas',
basemap: new Basemap({
id: 'lightGray',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/bdf1eec3fa79456c8c7c2bb62f86dade/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
},
darkGray: {
title: 'Dark Gray Canvas',
basemap: new Basemap({
id: 'darkGray',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/3e3099d7302f4d99bc6f916dcc07ed59/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
},
navigation: {
title: 'Navigation',
basemap: new Basemap({
id: 'navigation',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/00cd8e843bae49b3a040423e5d65416b/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
},
streetsNight: {
title: 'Streets Night',
basemap: new Basemap({
id: 'streetsNight',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/f96366254a564adda1dc468b447ed956/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
},
streetsRelief: {
title: 'Streets w/ Relief',
basemap: new Basemap({
id: 'streetsRelief',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/ad06088bd1174866aad2dddbf5ec9642/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
},
topo: {
title: 'Topographic',
basemap: new Basemap({
id: 'topo',
layers: [new BasemapLayer({
'styleUrl': '//www.arcgis.com/sharing/rest/content/items/be44936bcdd24db588a1ae5076e36f34/resources/styles/root.json',
'type': 'VectorTileLayer'
})]
})
}
]
}
},
lightGrayVector: {
title: 'Light Gray Canvas',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/bdf1eec3fa79456c8c7c2bb62f86dade/resources/styles/root.json',
type: 'VectorTile'
}
]
}
},
darkGrayVector: {
title: 'Dark Gray Canvas',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/3e3099d7302f4d99bc6f916dcc07ed59/resources/styles/root.json',
type: 'VectorTile'
}
]
}
},
navigationVector: {
title: 'Navigation',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/00cd8e843bae49b3a040423e5d65416b/resources/styles/root.json',
type: 'VectorTile'
}
]
}
},
streetsNightVector: {
title: 'Streets Night',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/f96366254a564adda1dc468b447ed956/resources/styles/root.json',
type: 'VectorTile'
}
]
}
},
streetsReliefVector: {
title: 'Streets w/ Relief',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/ad06088bd1174866aad2dddbf5ec9642/resources/styles/root.json',
type: 'VectorTile'
}
]
}
},
topoVector: {
title: 'Topographic',
basemap: {
baseMapLayers: [
{
url: 'https://www.arcgis.com/sharing/rest/content/items/be44936bcdd24db588a1ae5076e36f34/resources/styles/root.json',
type: 'VectorTile'
}
]
}
*/

}
};
*/
}
});

0 comments on commit 25a3893

Please sign in to comment.