How to export extent of map services to feature class?

3504
1
Jump to solution
04-07-2015 04:33 AM
ThorstenDey
New Contributor II

Hi ,

I want to convert the - sometimes irregular - extent of my map Services to a Feature class. The goal is to have an index layer that shows the user where a map service  (in the end there are more than hundred) is present. Certainly I could use the original raster catalogues and convert them to a feature class. But the (automated) export of the map service boundarys would be more secure and I have already published dozens of services.

Does anyone have an idea?

Best regards

Thorsten Dey

0 Kudos
1 Solution

Accepted Solutions
StephanMendler
New Contributor III

Hello Torsten,

this should be no problem. The REST API of ArcGIS for Server is also usable in scripts. So you could write a script which first asks for all services:

http://localhost:6080/arcgis/rest/services?f=pjson

Then you'll get a response with all folders and servies like this:

{

"currentVersion": 10.31,

"folders": [

  "Utilities"

],

"services": [

  {

  "name": "SampleWorldCities",

  "type": "MapServer"

  }

]

}

Then you can loop through all services and folders and ask the services for their info

like this:

http://localhost:6080/arcgis/rest/services/SampleWorldCities/MapServer?info&f=json

This will return the the information about every single service including the start extent. You can collect all these extents and write them into a FeatureClass. There is a good sample script, that shows how to do that:

Example: Write requested map extents to a feature class—Documentation (10.3 and 10.3.1) | ArcGIS for...

I hope this helps. Please feel free to contact me. We will see us the next days in the ArcGIS for Server training in Hamburg ;)

View solution in original post

1 Reply
StephanMendler
New Contributor III

Hello Torsten,

this should be no problem. The REST API of ArcGIS for Server is also usable in scripts. So you could write a script which first asks for all services:

http://localhost:6080/arcgis/rest/services?f=pjson

Then you'll get a response with all folders and servies like this:

{

"currentVersion": 10.31,

"folders": [

  "Utilities"

],

"services": [

  {

  "name": "SampleWorldCities",

  "type": "MapServer"

  }

]

}

Then you can loop through all services and folders and ask the services for their info

like this:

http://localhost:6080/arcgis/rest/services/SampleWorldCities/MapServer?info&f=json

This will return the the information about every single service including the start extent. You can collect all these extents and write them into a FeatureClass. There is a good sample script, that shows how to do that:

Example: Write requested map extents to a feature class—Documentation (10.3 and 10.3.1) | ArcGIS for...

I hope this helps. Please feel free to contact me. We will see us the next days in the ArcGIS for Server training in Hamburg ;)

View solution in original post