MapOverview widget problem - javascript api 3.2

670
4
10-31-2012 04:44 AM
MilanaNinkovic
New Contributor
Hello,

I have problem with mapOverview widget in javascript api 3.2. I have 2 map services in application (arcgis online and one local service - wkid 102100). After adding default mapOverview widget to application it sometimes works, sometimes don't causing the error TypeError: _9 is null in OverviewMap.js .
Changing baseLayer property of mapOverview widget to the local map service (it has to be local) causes mapOverview widget never works, reporting the same error.

My code looks like follows:


var onlnService = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
        {
     opacity: 1
 });

var local = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/lovistaWGS/MapServer",
     {
      opacity: 0.6
     });
var overviewLayer= new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/lovistaWGS/MapServer";

map.addLayers([arcgisonline, local]);

var overviewMapDijit = new esri.dijit.OverviewMap({
        map: map,
        visible: true,
        attachTo: "bottom-left",
        opacity: 0.5,
        color: "#000000",
        expandfactor: 4,
        maximizeButton: false,
        baseLayer: overviewLayer,
        visible: true
        });
    //}, dojo.byId("overviewDiv"));
    overviewMapDijit.startup();


What am I doing wrong?
0 Kudos
4 Replies
__Rich_
Occasional Contributor III
Maybe sometimes your chosen baseLayer hasn't loaded when you instantiate the OverviewMap, from the documentation:
baseLayer : Specify the base layer for the overview map. Note that the specified layer must be loaded, verify this using the layer's loaded property. If a base layer is not specified the dijit will use a copy of the main map's base layer....
0 Kudos
JeffJacobson
Occasional Contributor III
Have you tried creating the MapOverview widget in the map's OnLoad event?
0 Kudos
MilanaNinkovic
New Contributor
Have you tried creating the MapOverview widget in the map's OnLoad event?


I'm creating it on map's onLoad event. And can't figure out what the problem is.
0 Kudos
MilanaNinkovic
New Contributor
Maybe sometimes your chosen baseLayer hasn't loaded when you instantiate the OverviewMap, from the documentation:



geos_rfleet I think the loading is not a problem. I tried also with:
if (overviewLayer.loaded){
}
In this case layer is loaded but mapOverview still doesn't work.

Even if it is shown regularly first time, if I refresh the page it disappears.
0 Kudos