AnsweredAssumed Answered

BasemapGallery - Uncaught Error: Target must be an event emitter

Question asked by trevor.morgan_Huntsdc on Mar 3, 2015
Latest reply on Mar 4, 2015 by trevor.morgan_Huntsdc

Hi There,

 

I have been looking at using the Esri ArcGIS api. I haven't done dojo before and have run into an issue.

 

Im looking at using the basemapGallery, when isolated this works fine:

 

var map;

        require([

          "esri/map", "esri/dijit/BasemapGallery", "esri/arcgis/utils",

 

          "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane",

           "dojo/domReady!"

        ], function(

          Map, BasemapGallery, arcgisUtils

           ) {

 

          map = new Map("map", {

            basemap: "topo",

            center: [-105.255, 40.022],

            zoom: 13

          });

 

      //add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps

          var basemapGallery = new BasemapGallery({

                showArcGISBasemaps: true,

                map: map

          }, "basemapGallery");

          basemapGallery.startup();

       

          basemapGallery.on("error", function(msg) {

                console.log("basemap gallery error:  ", msg);

          });

        });

 

but when I combine it with my code i get the following error "Uncaught Error: Target must be an event emitter"

 

var map;

 

require([

    "esri/map",  "esri/InfoTemplate", "esri/Color", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ImageParameters", "esri/dijit/BasemapGallery", "esri/arcgis/utils",

    "dojo/dom", "dojo/dom-class", "dojo/dom-construct", "dojo/on", "dojo/query", "dojo/domReady!" ],

function(

    Map, InfoTemplate, Color, ArcGISDynamicMapServiceLayer, ImageParameters, dom, domClass, domConstruct, on, query, BasemapGallery, arcgisUtils

    ) {

  var layer, visibleLayerIds = [];

 

    map = new Map("map", {

        center: [ -0.181710, 52.328117 ],

        zoom: 12,

        basemap: "osm",

        infoWindow: infoWindow

    });

 

    //add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps

    var basemapGallery = new BasemapGallery({

        showArcGISBasemaps: true,

        map: map

    }, "basemapGallery");

  

    basemapGallery.startup();

    

    basemapGallery.on("error", function(msg) {

        console.log("basemap gallery error:  ", msg);

    });

 

MORE CODE....

 

Any help, or suggestions towards the solution would be gratefully recieved. Let me know if you need any more information.

 

Trevor

Outcomes