Monday 29 June 2015

arcgis server - Javascript Api's ArcGISTiledMapServiceLayer won't show map


I am currently trying to show a map that has been tiled. I am using version 10 of the Arcgis server, and version 2.5 of the Javascript api.


The odd thing I am running into is that the map will not show when using the constructor arcGISTiledMapServiceLayer but it will show when I'm using the alternate constructor arcGisDynamicMapServiceLayer.


Here is a very simple code snippet i'm using to test out my functionality



dojo.require("esri.map");
dojo.require("esri.tasks.geometry");
var map = null;
var gsvc = null;
var pt = null;

function initialize() {
map = new esri.Map("map");

var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer");


alert(map.toString());

map.addLayer(layer);

}


dojo.addOnLoad(initialize);


As you all have no doubt realized, this example code is using arcgisonline.com instead of my actual service that I'm running.


There is one more very important piece of information, this code above, works it shows the map but the same code with my url doesn't leading me to believe something is wrong with my server setup, but I am fairly new to arcgis so I'm not leaving any stones unturned.


If there are any querstions please feel free to ask.



Answer



See the details for the sample Esri service at that URL, which contains the line:



Single Fused Map Cache: true



Verify that your own service also contains this line - chances are that it doesn't. In that case you need to build a cache using the instructions at Creating map cache tiles.


You'll then be able to display your data as a tiled layer.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...