0

Is it possible to use a "Custom TiledMapServiceLayer" as a Basemap? Is it possible to show a "Custom TiledMapServiceLayer" in BasemapGallery?

1 Answer 1

1

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
                    })]
                })
            },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.