Select to view content in your preferred language

Any reason why a basemap might not draw at first?

1608
11
Jump to solution
10-01-2013 09:16 AM
TracySchloss
Honored Contributor
I have several projects that have the basemap defined as part of the map constructor.  I have a project I'm reworking in the AMD style, so I'm going through, changing the code as best I can.  Maybe I've hit a gotcha on this one that I'm not aware of. 

The definition for the map is

  highlightMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 22,    new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,    new Color([255,255,0]), 2),    new Color([255,255,0,0.5]));    var popup = new Popup({      markerSymbol: highlightMarkerSymbol,     fillSymbol: new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,      new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,      new Color([255,200,0]), 2), new Color([255,255,0,0.50]))     }, dojo.create("div"));           map = new Map("mapDiv", {        infoWindow: popup,       basemap: "topo",       center: [-92.593, 38.5],       zoom: 7     });   


After this I load a few different layers.  I'm also defining a basemapGallery to let the users change the background.  All my layers load fine and I'm not getting any errors.  When my page first loads, there is no basemap displayed, it's just blank.  If I zoom in a couple of times, then it draws.  If I use my tool to change the basemap, it also works fine.  I tried a few different basemaps, not just topo, with the same results. 

Can anyone provide some insight as to why the basemap might not draw at first?  I have this same syntax in other projects and it works just fine in them!
0 Kudos
11 Replies
KellyHutchins
Esri Notable Contributor
I took a quick look at your attached code and noticed that in the  map's onLoad you are creating a scalebar then calling startup. The scalebar widget doesn't have a startup method so try commenting out that line and see if it resolves the basemap loading issue.
0 Kudos
TracySchloss
Honored Contributor
That was it!  I didn't think too much about that.  It was right under my basemapGallery definition, so I just figured scaleBar needed startup as well.
0 Kudos