ArcGIS for JS Grid Layer Layer Question

Actually, this problem may be not very large with the Raster Layer relationship, or all types of layers have this problem, I have not very understandable ArcGIS, currently only in the grid map. The layer encountered problems, so let’s write down, and doubt.

What is the problem of grid layers? Can’t overlap, error.

For example, there is such a map service:

arcgis for js栅格图层叠加(Raster Layer)问题 Then I want to directly superimpose one of the sub-layers (see the type of the grid layer).

The code is as follows:

arcgis for js栅格图层叠加(Raster Layer)问题

Var layer = new ArcGioNamicMapServiceLayer (“ ArcGIS / HN_TEST / MAPSERVER / 1 “); map.addlayer (layer);
  But this must be an error. Newspaper "400" error, error prompt: does not support the output format.  Error: Output Format Not Supported. 
Code: 400
Does the format? It is image format. There are many species in the format of ArcGIS layer service, see here

However, if only the root address of the layer service is access, the layer can come out:

VAR LAYER = New ArcGIndynamicMapServiceLayer (“”); //

  <----------------- 后面没有“/1”
When I stacked Featurelayer, I was directly visiting the child layer, fromI have no problem. Why can’t you use

ArcGisimageServiceLayer, arcgis for js栅格图层叠加(Raster Layer)问题 RasterLayer



Will not work. The top three direct report 400 faults, the last two have not reported, but the layers are not coming.

Is the grid layer so special?

From Saturday, to Tuesday, Tuesday, spent this question every day, asked two masters, but the master did not have time, there is a actually mentioning the question, but I don’t understand I still can’t do it. This kind of problem, to Baidu, there is no way, there is no code to mention the raster layer (this also proves that the grid layer does not need to handle any special objects).

Later, I later saw that there was an article on the Internet to mention the map service, control the sub-layer, I think that when I first started ArcGIS, I saw similar code, used to display or hide different Layer. Turning out, sure enough, the layer object has a LayerInfos property, which is a list of all sub-layers. All, not just a son, but also a grandson and future generation. But this LayerInfos load requires a certain process, which is generally started to be accessed in an event that is loaded.

Modify the code, the image is finally coming out.

The processing process is as follows:

1, construct a dynamic slice layer object

arcgis for js栅格图层叠加(Raster Layer)问题 VAR Layer = New ArcGIsDynamicMapServiceLayer (;

2, after the layer object is loaded, set the sub-layer visible attribute
   IF (layer.loaded) {buildsublayerlist (layer);} Else {dojo.connect (Layer, "OnLoad", BuildSublayerlist);} Function Buildsublayerlist (Layer) {var Var Visible = []; (Layer.LayerInfos, Function (Info, Index) {IF (Compliance) Visible. Push (;}; map.addlayer (layer); // 万 事 备, to this party to add layers to map} 

  The above is the raster layer described above, I hope to help everyone, if you have any questions, please leave a message, Xiaobian will reply to everyone in time. Thank you very much for your support of Tumi Cloud Website!  
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment