Select to view content in your preferred language

Custom Basemap Issues

3377
5
Jump to solution
08-14-2012 01:16 PM
james-rae
Occasional Contributor
Hello, am hoping a second set of eyes may point out what I'm doing wrong.

Using the FlexViewer 3.0 template.  I have an ArcGis tile cache on my own web server, and would like the Map Switcher Widget to show my tile and one of ESRI's public tiles as two available choices.

In config.xml:
I've set addarcgisbasemaps="false" in my map tag.

My basemap tag looks like this:
<basemaps>  
<layer label="Oil Map" type="tiled" visible="true" alpha="1"
  url="http://myserver.mydomain.ca/ArcGIS/rest/services/myservice/MapServer" />
  
<layer label="World Map" type="tiled" visible="false" alpha="1"
  url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" />
</basemaps>


In this configuration, my basemap will show but the ESRI basemap will be blank when I select it from the widget.
If I switch the order of the layer tags, the ESRI basemap will show but my basemap will be blank.
(Note: my server is behind a firewall at the moment, that's why I can't share the url).

I've traced the loading logic down to the map.addLayer() call in function addLayerToMap in MapManager.mxml, and can't trace into it to see if anything wonky is happening there.  After the site loads, I can look into the map.layers collection and verify that both basemap layers are present.  Eyeballing the properties reveals nothing suspicious.

Both servers hosting the tiles have crossdomain.xml files that allow everything.
Both caches are 256x256 tiles in the same projection.

Two differences (which I don't have the luxury of changing in the short term):
1. ESRI's arc-server is version 10.01 and mine is 10.02.
2. The scale levels on the caches are slightly off.
E.g.
Scale 9028 vs 9027.977411
Scale 73,957,376 vs 73,957,190.948944


Clearly the first basemap (which is also the first layer loaded by the Viewer) is affecting the second basemap, but I'm at a loss why.
Also note that I'm able to add feature layers on the map without issue.

Any ideas are most welcome.  Particularly if it is known that the slight difference in scale is a problem.  Thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Notable Contributor
If they are different wkid's, you can set the world map type="dynamic" and it will work.

will slow it down some.

R_

View solution in original post

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
James,

   Is your cached map service using WKID: 102100 or 3857? Because the only way to get two cached/tiled basemaps to work together is to make sure they are in the same spatial reference/WKID.
0 Kudos
RhettZufelt
MVP Notable Contributor
If they are different wkid's, you can set the world map type="dynamic" and it will work.

will slow it down some.

R_
0 Kudos
james-rae
Occasional Contributor
Thank you both for the responses.
My tile service is in WKID 102100 (3857).  Switching to dynamic did not change the behavior of the issue.

Another item that may be useful: I've been scoping out the web traffic out of the flex app using Fiddler, and when a "blank" basemap is active it's not even trying to make requests to the server for tiles.  Also, no security/cross-domain issues showing up in the traffic.

Anyhow, I think I'll let this stew for a day or two and come back to it with a fresh perspective.

Thanks again.
0 Kudos
james-rae
Occasional Contributor
Just to close this thread...
Turns out I can get the ESRI tile to show in "dynamic" mode...I just had to put the layer in the <operationallayers> tag instead of the <basemaps> tag. 
Slow, but will suffice for now.
I'm convinced the issue is caused by the difference in the level-of-detail between the two caches.  Long term, looks like I'll have to regenrate my tile to exactly match ESRI's LOD scheme.
0 Kudos
RhettZufelt
MVP Notable Contributor
You should be able to put both in the basemaps section, I have done this successfully several times.

You just need to make sure that YOUR basemap is loaded first as tiled (which sets the wkid and LODs) (unless you override the wkid in the map tag).
and then load the ESRI map as dynamic
<basemaps> 
<layer label="Oil Map" type="tiled" visible="true" alpha="1"
url="http://myserver.mydomain.ca/ArcGIS/rest/services/myservice/MapServer" />

<layer label="World Map" type="dynamic" visible="false" alpha="1"
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" />
</basemaps>


This works fine for me (well, with my basemap instead of yours ).  Just have to "wait" for the world map, especially the first time you load/zoom.

R_
0 Kudos