If not, is there another way to do this programmatically? I would much prefer to be able to use the REST interface as I am using that for all my other requests
Thanks for you reply Jake.
I had a look at the JSON and I can see the setting in properties. Unfortunately I cannot readily get this information. Currently, my application uses the ArcGIS REST API to render map images using the Print Tools ExportWebMap and I want to use the Export Map facility in the map services because it is quicker and more flexible (and less buggy;-). I need to use dynamic workspaces for this so I need to know in advance whether a map service has a dynamic workspace in it.If the service does not have a suitable dynamic workspace then I revert to my current method of rendering the map image.
Maybe the best way is to send a test "dummy" request to the service when I get its information and check the response? It is just a bit of a nuisance!
Cheers,Chris
Hi Christopher,
Not sure if there is a way to do this using the REST API, but here is an example using python to query the serviceconfiguration.json file that is created with the service:
<SPAN class="keyword token">import</SPAN> json <SPAN class="keyword token">with</SPAN> open<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"D:\arcgisserver\directories\arcgissystem\arcgisinput\Airports.MapServer\extracted\serviceconfiguration.json"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> datafile<SPAN class="punctuation token">:</SPAN> data <SPAN class="operator token">=</SPAN> json<SPAN class="punctuation token">.</SPAN>loads<SPAN class="punctuation token">(</SPAN>datafile<SPAN class="punctuation token">.</SPAN>read<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> datafile<SPAN class="punctuation token">.</SPAN>close<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> data<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'service'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'properties'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'dynamicDataWorkspaces'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
This will return:
<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="string token">"id"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="string token">"MyFileGDBWorkspaceID"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"workspaceFactory"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="string token">"FileGDB"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"workspaceConnection"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="string token">"DATABASE=D:\\Temp\\Python\\Test.gdb"</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.