0

I am using ArcGIS Server 9.3.1 SP 1. I want to be able to determine the capabilities of each published layer, specifically I am looking for all layers with query capabilities.

Being familiar with ArcGIS Server 10 I thought I could programmatically inspect the capabilities list on the layer response page. For example, Average US Household Size has MAP, QUERY, and DATA capabilities.

However it appears that ArcGIS Server 9.3.1 does not publish layer capabilities through the REST API. I think that I could get this information by scraping the HTML for the layer resource and looking for the list of supported operations in the HTML.

<a href="/ArcGIS/rest/services/Demographics/USA_Average_Household_Size/MapServer/1/query">Query</a>

But this seems like brittle code.

How would you programmatically determine if a layer supports the query capability via the ArcGIS Server 9.3.1 REST API?

2 Answers 2

1

Here is an article that shows how to get all the service layer's information:

How to Get ArcGIS Server Layer Information

2
  • Unfortunately, the REST API at 9.3.1 does not expose the layer's capabilities on in JSON response as far as I can tell. Commented Mar 25, 2012 at 15:42
  • 1
    You're right, this will work only with the 10 API, the 10 API will return the parameter: '"capabilities" : "Map,Query,Data"'
    – Khattab
    Commented Mar 25, 2012 at 20:03
1

Unfortunately, the only way to programmatically determine if an ArcGIS Server 9.3.1 Layer has query capabilities is to make a GET request for the layer's resource page and search for "Query Layer" HTML content.

Here is a bit of Flex code that does just that. I specifically first search for "Support Operations" text and it's location in the content. If that is found I then search for "Query Layer" but only if it appears after where "Support Operations" was found to reduce chances of false positives. It's not ideal but it works in a pinch.

Error handling has been removed to simplify the example.

var layerResourcePage:HTTPService = new HTTPService(); 
layerResourcePage.url = layerUrl;
layerResourcePage.method = "GET";
layerResourcePage.resultFormat = HTTPService.RESULT_FORMAT_TEXT;

var asyncToken:AsyncToken = layerResourcePage.send();
var asyncResponder:IResponder = new AsyncResponder(onLayerResourcePageLoaded, onLayerResourcePageFailed, token);
asyncToken.addResponder(asyncResponder);

function onLayerResourcePageLoaded(result:ResultEvent, token:Object):void
{
    var html:String = result.result as String;

    var supportedOperationsIndex:int = html.indexOf("<b>Supported Operations: </b>");
    var supportedOpsFound:Boolean = supportedOperationsIndex != -1; 
    if (supportedOpsFound == true)
    {
        var queryCapabilityIndex:int = html.indexOf("Query Layer", supportedOperationsIndex);
        _queryCapabilityFound:Boolean = queryCapabilityIndex != -1;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.