Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with local basemaps #11

Closed
abbasbeigy opened this issue Feb 7, 2019 · 1 comment
Closed

problem with local basemaps #11

abbasbeigy opened this issue Feb 7, 2019 · 1 comment

Comments

@abbasbeigy
Copy link

HI Dear
I have a problem with set custom basemap.

i want to set owner basemap from local server and not onlie basemap like osm or other online basemap.
this is my basemaps.js and viewer.js config.
when i set basemap to osm app is start normally but when i set basemap to my local basemap app not load.
thanks

viewer.js
define([
'esri/units',
'esri/layers/ImageParameters',
'dojo/topic'
], function (units, ImageParameters) {

// helper function returning ImageParameters for dynamic layers
// example:
// imageParameters: buildImageParameters({
//     layerIds: [0],
//     layerOption: 'show'
// })
function buildImageParameters (config) {
    config = config || {};
    var ip = new ImageParameters();
    //image parameters for dynamic services, set to png32 for higher quality exports
    ip.format = 'png32';
    for (var key in config) {
        if (config.hasOwnProperty(key)) {
            ip[key] = config[key];
        }
    }
    return ip;
}

return {
    // used for debugging your app
    isDebug: true,

    //default mapClick mode, mapClickMode lets widgets know what mode the map is in to avoid multipult map click actions from taking place (ie identify while drawing).
    defaultMapClickMode: 'identify',
    // map options, passed to map constructor. see: https://developers.arcgis.com/javascript/jsapi/map-amd.html#map1
    mapOptions: {
        basemap: new Basemap({
            id: 'basemap1',
            layers: [new BasemapLayer({
                url: 'http://localhost:6080/arcgis/rest/services/BaseMap/BaseMaps/MapServer'
            })]
        }),
        center: [30.8, 38.7],
        zoom: 12,
        sliderStyle: 'small'
    },

basemaps.js
define([
'esri/dijit/Basemap',
'esri/dijit/BasemapLayer',
'dojo/i18n!./nls/main'
], function (Basemap, BasemapLayer, i18n) {

return {
    map: true, // needs a reference to the map
    mode: 'custom', // mut be either 'agol' or 'custom'

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

    /* 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: ['osm','BaseMap1'],

    // define all valid basemaps here.
    basemaps: {

        osm: {},
        BaseMap1: {
            title: 'arial',
            basemap: new Basemap({
                id: 'basemap1',
                layers: [new BasemapLayer({
                    url: 'http://localhost:6080/arcgis/rest/services/BaseMap/BaseMaps/MapServer'
                })]
            })
        }

    }
};

});

@tmcgee
Copy link
Member

tmcgee commented Feb 7, 2019

@abbasbeigy For questions about CMV configuration, please open an issue in the main cmv-app repo. This repo is specific to using CMV with Esri's Calcite Maps.

@tmcgee tmcgee closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants