[mapguide-users] XYZ tile source support - Cannot setActive of undefined

RenoSun renolionheart at gmail.com
Tue Jul 30 14:06:10 PDT 2019


Hi All,

I am trying to use the XYZ tile source support, and it works well using
Fusion. However, I record the base map option using URL parameter, and the
Fusion will setActive the base map based on the URL parameter using
following codes:

        if (getParamFromTop("baseMap") !== '' && getParamFromTop("baseMap")
!== null && typeof this.menuItems[getParamFromTop("baseMap")] !==
"undefined") {
            this.menuItems[getParamFromTop("baseMap")].setActive(true);
        }
        else {
            this.setBasemap(this.defaultBasemap);
        }

I will not be able to setActive of the undefined item from the menuItems. 

I think it maybe because we do not have XYZ options set up as default
options of the menuItems dynamically as following:
    refreshSettings: function() {
        this.baseMaps = {};
        this.defaultBasemap = null;
        this.menuItems = {};
        this.options = {
            'G_NORMAL_MAP': null,
            'G_SATELLITE_MAP': null,
            'G_HYBRID_MAP': null,
            'G_PHYSICAL_MAP': null,
            'Road': null,
            'Aerial': null,
            'AerialWithLabels': null,
            'Mapnik': null,
            'TransportMap': null,
            'CycleMap': null,
            'None': null
        };
    },

Also, the setBasemap: function (baseMap) will not work neither:
Error Details:
Exception occurred in AJAX callback.
Message: Cannot read property 'oLayerOL' of undefined
Location: undefined (undefined)

Hope to get this work.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html


More information about the mapguide-users mailing list