Search code examples
c#restarcgis

List all arcgis layers info with ArcGIS.PCL


I'm using ArcGIS.PCL with C# to query information from an Arcgis server and REST web service. I know how to query a specific layer to see all the fields and information in general about it. But how can I query the server to return the list of layers?

I can use this URL for a specific layer (id=0): http://server/arcgis/rest/services/myassets/assets/MapServer/0

but if I don't know the ID of the layer, what can I do to iterate through all of them?

I know I can use this URL: http://server/arcgis/rest/services/myassets/assets/MapServer/ and the server returns all the information, but I don't know which method to use from this ArcGIS.PCL library to map the results to classes.

Also, if I query data from a specific layer and its fields, what are the parameters to use to return all the info of all the fields? At the moment I use "*" for outFields and "1=1" for the Where clause, but feels a bit hackish.

Anyone's got experience with this library?

Thanks!


Solution

  • There isn't a operation for that defined as of yet though there is still a way to do it. The test project has an example which will just map the result to a dictionary though you can just define your own type to do it too if you prefer.

    If you want to get a collection of services for the site you can use DescribeSite.

    Using * for outFields is correct if you want all the fields returned, otherwise you need to list the ones you want. Any where clause is needed as otherwise ArcGIS Server will throw an error so using 1=1 is the simplest way to get all data.