Select to view content in your preferred language

Map Service LayerInfos does not "find" table

738
1
Jump to solution
09-16-2013 02:22 PM
CameronBlandy
Regular Contributor
I have a Map Service (ArcGIS Server 10.0 SP 5) that has 3 Layers and one Table. I am trying to access all of the Layers and Tables in code using the LayerInfos property. To my shock the Table is not listed in the LayerInfos. I need to search the Map Service for the Layer Name (table name) and get the Layer id (table id). What do I need to do to get LayerInfos to list Tables as well as the Layers.

Regards,
Cameron.
0 Kudos
1 Solution

Accepted Solutions
JasonZou
Frequent Contributor
LayerInfos is not for tables, but layers only. Make call to the rest endpoint of the map service layers like the below code sample.

var serviceLayersRequest = esri.request({   url: "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/layers",  // change to your url   content: { f: "json" },   handleAs: "json",   callbackParamName: "callback" }); serviceLayersRequest.then(   function(response) {     console.log("Success: ", response.layers);     console.log("Success: ", response.tables); }, function(error) {     console.log("Error: ", error.message); });

View solution in original post

0 Kudos
1 Reply
JasonZou
Frequent Contributor
LayerInfos is not for tables, but layers only. Make call to the rest endpoint of the map service layers like the below code sample.

var serviceLayersRequest = esri.request({   url: "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/layers",  // change to your url   content: { f: "json" },   handleAs: "json",   callbackParamName: "callback" }); serviceLayersRequest.then(   function(response) {     console.log("Success: ", response.layers);     console.log("Success: ", response.tables); }, function(error) {     console.log("Error: ", error.message); });
0 Kudos