Select to view content in your preferred language

API v2.6 breaks Bing maps backgrounds?

2090
22
12-14-2011 12:38 PM
StephenLead
Honored Contributor
I have a page which works correctly using v2.5 of the API. If I replace the API version with "2.6" in the lines:

<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6"></script>


the map loads correctly, and my FeatureLayers and DynamicLayers are displayed - but the Bing maps backdrop is missing.

If I revert to 2.5 in these two lines, Bing maps appears.

Any clues?

Thanks,
Steve
0 Kudos
22 Replies
JeffPace
MVP Alum
Jeff,

I can't reproduce with this sample:

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/widget/widget_basemap.html

Can you repro with that sample? If so can you provide me with a series of steps that will show the problem. I tested switching basemaps and using the scroll wheel to zoom and everything looked ok to me.


Your sample works for me also

I get

exception in animation handler for: onEnd
?v=2.6 (line 14)
TypeError: n is null
(function(){var _1=null;if((_1||(typeo...etTimeout(dojo._loadInit,100);}})();

After any zoom event using BasemapGallery and 2.6 .  Switching back to 2.5 and error goes away
0 Kudos
JeffPace
MVP Alum
Your sample works for me also

I get

exception in animation handler for: onEnd
?v=2.6 (line 14)
TypeError: n is null
(function(){var _1=null;if((_1||(typeo...etTimeout(dojo._loadInit,100);}})();

After any zoom event using BasemapGallery and 2.6 .  Switching back to 2.5 and error goes away



Interesting:

Looking in firebug

IF i zoom from level 10 to level 15:

1. Operational layers tile requests (from the net tab in firebug) make requests from level 15
2. Tiled layers make new tile requests from level 10.
0 Kudos
KellyHutchins
Esri Notable Contributor
Jeff,

We'd really like to try and reproduce this issue but so far no luck. Just to clarify can you reproduce the problem with the sample or is it only your application? Since you are seeing errors in Firebug I assume you are seeing the issue in Firefox - which version?

If you can't reproduce with the sample do you have a url that shows the problem?
0 Kudos
JeffPace
MVP Alum
Jeff,

We'd really like to try and reproduce this issue but so far no luck. Just to clarify can you reproduce the problem with the sample or is it only your application? Since you are seeing errors in Firebug I assume you are seeing the issue in Firefox - which version?

If you can't reproduce with the sample do you have a url that shows the problem?


I am working on it.  Your code works for me.  It is only internal at the moment.  Firefox 8.
0 Kudos
JeffPace
MVP Alum
Ok i figured my issue out, but it is very app specific.

I use a onExtentChange event to hide items in the Gallery if they aren't available at a particular level (i.e. hide the "OpenStreetMap" option at level 19).

I hide them by doing

dojo.style(dojo.byId(id), "display", "none");

If i comment out the line in my extent change handler my app works again. 

So it turns out, i was manually (hardcoding) look for some particular layers to hide.  One of them was
"USA Topo Maps"

Apparently that is not in the 2.6 api for the Gallery, so when i went to hide it, I was trying to access it byId, I was accessing a null object.
0 Kudos
StephenLead
Honored Contributor
Are you specifying a valid bing maps key for the BasemapGallery?

var basemapGallery = new esri.dijit.BasemapGallery({
  showArcGISBasemaps: true,
  bingMapsKey:'Enter Bing Maps Key Here',
  map: map
}, "basemapGallery");


Hi Kelly,

In my case I'm using the above syntax (not the basemap gallery widget) and Bing Maps is shown when the API is 2.5.

When I change the API to 2.6 (with no other changes) Bing Maps is not shown (regardless of the scale). Firebug doesn't show any calls (failed or otherwise) out to the Bing Maps service.

If I revert to 2.5, Bing Maps shows and Firebug reports a bunch of calls to http://t1.tiles.virtualearth.net/tiles/h311203.jpeg etc.

I'm testing on an internal build of http://atlas.nsw.gov.au/public/nsw/home/map/base.html - unfortunately I don't have an externally accessible URL for the dev build.

I'll keep playing around with it and will let you know of any progress.

Cheers,
Steve
0 Kudos
JeffPace
MVP Alum
Ok i figured my issue out, but it is very app specific.

I use a onExtentChange event to hide items in the Gallery if they aren't available at a particular level (i.e. hide the "OpenStreetMap" option at level 19).

I hide them by doing

dojo.style(dojo.byId(id), "display", "none");

If i comment out the line in my extent change handler my app works again. 

So it turns out, i was manually (hardcoding) look for some particular layers to hide.  One of them was
"USA Topo Maps"

Apparently that is not in the 2.6 api for the Gallery, so when i went to hide it, I was trying to access it byId, I was accessing a null object.



Kelly, Is there a service or description somewhere we could query to figure out what services are included in the BasemapGalleryWidget by default?
0 Kudos
KellyHutchins
Esri Notable Contributor
Jeff,

I don't think there is a list or service that defines the basemaps that will be included in the basemap gallery. However if you want control over the basemaps you might want to look at the basemapsGroup option that was added at 2.6 to the BasemapGallery. This option allows you to specify an ArcGIS.com group that contains the basemaps that will be used by the gallery. You could create an ArcGIS.com group and add the basemaps you want so you have complete control.  For example, here we add all the maps in the 'Community Basemaps' group:

 var basemapGallery = new esri.dijit.BasemapGallery({
   showArcGISBasemaps: false,
   basemapsGroup:{owner:"esri",title:"Community Basemaps"},
   map: map
 }, dojo.create('div'));
0 Kudos
StephenLead
Honored Contributor
An update on this problem - it seems that Bing maps doesn't show when using v2.6 if the code is hosted locally, but does work if the same code is run from a web server.

It's a bit hard to isolate exactly what's happening since the simple samples do work locally.

I'll let you know if I can provide a simpler reproducible example.

Thanks,
Steve
0 Kudos
EdSaunders
Regular Contributor
Steve, just a comment on this.  I'm using the following line and Bing Maps shows up fine:

<script type="text/javascript" src="js/arcgis.js"></script>

This is a downloaded version 2.6 of the ArcGIS API for JavaScript.

Ed
0 Kudos