mix tiled and dynamic map on a single display

4598
4
05-12-2012 02:49 AM
PreranaDoshi
New Contributor
Hello All,

I want to use tiled and dynamic service on a single map.

Let me introduce you to the problem and give a background for doing this.
I have a map where I am caching the ground areas but due to space constraints, I want to avoid caching the oceans.
Now, I have achieved this by restricting the tiles creation using the feature class. The problem is that in this approach, the tiles would keep on growing on larger scales, if the users go to the oceans areas and zoom/pan. So, as a solution, I am trying to use a combination of tiles and caches to avoid this slow but steady increase of space cache takes on disk.

I feel that this would be the most common problem on any mapping service, but I have not been able to find a solution to this problem online.
I have tried using adding two layers, one tiled other dynamic, to the map, but I cannot view both together on the screen. Only dynamic is shown...
Also, firebug shows these errors:
[ATTACH=CONFIG]14280[/ATTACH]

This is the sample javascript:

     function init() {
        loading = dojo.byId("loadingImg");  //loading image. id --> Not present, no problem
        var extent = getExtent();
        initExtent = new esri.geometry.Extent({
                                                "xmin":-100,
                                                "ymin":13,
                                                "xmax":-85,
                                                "ymax":24,
                                                "spatialReference":{"wkid":4326}
                             }); //spatial reference for lat/long            
        esriConfig.defaults.map.slider = { left:"10px", top:"10px", width:null, height:"150px" };
        map = new esri.Map("map", {extent:initExtent, slider: true});
        var imageParameters = new esri.layers.ImageParameters();
        
        imageParameters.format = "JPEG";  //set the image type to JPEG, note default is PNG8.
        
  map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("http://192.168.250.75:8399/arcgis/rest/services/surroundings/MapServer")); 
 ground = new esri.layers.ArcGISTiledMapServiceLayer( "http://192.168.250.75:8399/arcgis/rest/services/mexLoadBal/MapServer");
 dynamicMapServiceLayer09 = ground;
        var imageParameters = new esri.layers.ImageParameters();
        imageParameters.format = "JPEG";  //set the image type to JPEG, note default is PNG8.

 
        var layer = map.addLayer(dynamicMapServiceLayer09);
        if (layer == null)
            {
                alert("map layer is null, could not add map layer to map");
            }
                    
 map.reorderLayer(ground,0);

        dojo.connect(map, "onClick", function(evt) {
          map.graphics.clear();
          locator.locationToAddress(evt.mapPoint, 500);
        });

        dojo.connect(map,"onUpdateStart",function(){
          esri.show(dojo.byId("status"));
          showLoading();
        });
        dojo.connect(map,"onUpdateEnd",function(){
          esri.hide(dojo.byId("status"));
          hideLoading();
        });
        
        dojo.connect(map, "onExtentChange", showExtent);
        dojo.connect(map, "onExtentChange", saveExtgent); // save Extent of the current loaded map
        dojo.connect(map, "onMouseMove", showCoordinates);
        dojo.connect(map, "onMouseDrag", showCoordinates);   
        dojo.connect(map, "onLoad", createMenus);
           
      }
      /*****************************************/


Regards,
Ashish
0 Kudos
4 Replies
PreranaDoshi
New Contributor
Some progress.

I have been able to show both type of maps on the screen
The way around is to first add the cached layer on the map and then add the dynamic layer.
Since I want my cached layer to be selectable by the user, I have then reordered the layers so that the cached (ground) layer comes on the top.

Now, my problem is that in the cached map, there are tiles that contain white space (the boundary areas; ie the areas corresponding to ocean shores)
These cover the oceans in the dynamic layer (below the tiles) and so, the user can only view the blank (white) spaces near the shores, where the tile is formed.

I have thought of a solution to this problem;
a. Add the all layers (oceans and neighboring countries) in cached map service.
b. Set the map max extent in arcDesktop to cover the ONLY the ground.
c. Create 2 services, one tiled (with all layers) and other dynamic (only with oceans and neighboring countries) as before
d. Add the layers on the map.

Please let me know if this solution is the best available or there is some better option available.
0 Kudos
JeffPace
MVP Alum
JPEG doesn't support transparency, which is why you are seeing the white.  If you switch to png32 this might help.

Your solution of two map services working together is novel and i think has potential. 

I dont know how irregular you land is, but clipping to it still generates a square tile.  You might instead try clipping at the tile boundary (since it is fixed) and putting the transition from land to water on a tile seam, if possible, this will of course depend on scale and whether or not it is worth that much effort.
0 Kudos
by Anonymous User
Not applicable
Hopefully this post helps. I think you will benefit from "On Demand" caching.  Check out this link.

http://resources.arcgis.com/en/help/main/10.1/index.html#//01540000045s000000

As for the regions / areas of your map which you think will be frequently visited, you can define and create what's called a precache.

Regards,
Doug Carroll, ESRI Support Services, SDK Tech Lead
http://support.esri.com/
0 Kudos
MarkHiscocks
New Contributor

Avoid "On Demand" caching! After having tiles take upwards of 3 minutes to generate with my services, ESRI eventual got back to me and said "do not use" this feature as it does not work as advertised.

0 Kudos