Hi,
If I use the 3.9 of the ArcGIS Javascript library this works fine, but I've found if I use 3.10 or 3.11 I no longer get basemaps.
I'm adding the proxy rule like this:
esri.urlUtils.addProxyRule({
urlPrefix: "server.domain.com",
proxyUrl: "http://localhost/proxy/proxy.ashx"
});
I'm adding my map like this:
map = new esri.Map("mapDiv", {
center: [-100.167, 48.167],
zoom: 5,
basemap: "topo"
});
If I remove the proxy rule the basemap comes up fine. The proxy I'm using is the one from github
Any suggestions?
Mike
Hi Michael,
I think if basemap is cached you would also have to add tile server url in proxy rule. You can find tile server url from ArcGIS rest end point or use fiddler or browser network panel to identify the url.
I hope this helps.
Regards,
Rahul
Sent from my Windows Phone
Hi Rahul,
Sorry I probably wasn't specific enough in my description. The proxy rules are only for ArcGIS web services on our server. I don't want the basemap to route through the proxy. Even though I don't have any of the esri sites in the proxy rules, somehow the having the proxy rules there seems to effect the access of the basemap layer.
As mentioned this same code works under js.arcgis.com/3.9 but upon changing it to js.arcgis.com/3.10 I get no layers on my map (including the basemap). If I comment out the lines related to the proxy rules then I get a basemap. So something must have changed in regards to the way the proxy rules are handled between 3.9 and 3.10
Any assistance would be appreciated.
Thanks!
There are a few samples in the JSAPI resource center that use addProxyRule and they work at 3.9+ - check out the Directions sample for one example:
Directions | ArcGIS API for JavaScript
If you run your app with browser developer tools open are there any error messages written to the console?
I'm having a very similar problem. I added a proxyRule for my local secure server, but do I need to add another one for the ESRI base maps? I am getting an initial basemap from my map creation. I'm getting errors when creating a BasemapGallery.
The error comes when I first load the page:
esri.dijit.BasemapGallery: Unable to find the 'map' property in parameters.
I use BasemapGallery in nearly all my maps and I know the syntax is pretty straight forward. I have loaded the Search widget using the exact same syntax for the map parameter and it loads just fine.
//basemapgallery widget
app.basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: app.map
}, "basemapGalleryDiv");
app.basemapGallery.startup();
app.basemapGallery.on("error", function(msg){
console.log("basemap gallery error: ", msg.message);
});
Even with the error, the thumbnails load OK in my side panel, but when I try to change the basemap I'm getting the error
basemap gallery error: esri.dijit.BasemapGallery: could not find group for basemaps.
The only difference between this map and others is that I have secured services, so I need the proxy set up and I'm using IdentityManager.
The initial error seems to come from this ServerInfo definition:
var serverInfo = new ServerInfo();
serverInfo.server = pathName;
serverInfo.tokenServiceUrl = pathName+"/arcgis/tokens/generateToken";
I'm not sure why I had that in the first place. I commented these lines out and there is no error when I load the map. I'm still getting the error when I try to switch basemaps, though.
I finally solved this by waiting until the secured layers were getting loaded. I put a load listener on a featureLayer to create the basemapGallery then. No more errors and switching basemaps works as well.
on(app.secureLayer, 'load', function (evt){
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: app.map
}, "basemapGalleryDiv");
basemapGallery.startup();
on(basemapGallery, "error", function(msg){
console.log("basemap gallery error: ", msg.message);
});
});