<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Programatically update a map service in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734391#M56928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;At this point, I just want to know if the following is possible by writing code (probably VB or even Python?):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 1. Open a map document and update the data source of several shapefiles&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 2. Save the map document&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 3. Stop and restart the map service associated with the map document&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 4. Empty the map server cache so that the map document changes are propagated to the map service&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, Server 9.3 running on a Windows 2008 server&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Mar 2011 13:57:26 GMT</pubDate>
    <dc:creator>TyroneLigon</dc:creator>
    <dc:date>2011-03-30T13:57:26Z</dc:date>
    <item>
      <title>Programatically update a map service</title>
      <link>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734391#M56928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;At this point, I just want to know if the following is possible by writing code (probably VB or even Python?):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 1. Open a map document and update the data source of several shapefiles&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 2. Save the map document&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 3. Stop and restart the map service associated with the map document&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 4. Empty the map server cache so that the map document changes are propagated to the map service&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, Server 9.3 running on a Windows 2008 server&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 13:57:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734391#M56928</guid>
      <dc:creator>TyroneLigon</dc:creator>
      <dc:date>2011-03-30T13:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Programatically update a map service</title>
      <link>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734392#M56929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;At ArcGIS 10 there is the new arcpy.mapping module that allows you to repair/remap data sources very easily.&amp;nbsp; However, at 10 you still cannot use python to stop/start ArcGIS Server services.&amp;nbsp; It looks like there has been an enhancement request logged for this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NIM063303: Provide functionality in ArcPy for managing map services.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your best bet would be to use .NET.&amp;nbsp; I found some example code for stopping/starting services here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#//009300001655000000.htm"&gt;http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#//009300001655000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 14:43:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734392#M56929</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-03-30T14:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Programatically update a map service</title>
      <link>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734393#M56930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have achieved a similar task using python to change the data source and save the map, and then using &lt;/SPAN&gt;&lt;A href="http://arcscripts.esri.com/details.asp?dbid=16293"&gt;AGSSOM&lt;/A&gt;&lt;SPAN&gt; to restart the map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to make this work, I had to write a batch file with the AGSSOM command line argument:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSSOM.exe -r USABasemapService &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then call the batch file from my python script after the map has been saved:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;os.system('restartHeatMap.bat');&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2011 10:32:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/programatically-update-a-map-service/m-p/734393#M56930</guid>
      <dc:creator>TylerGarner</dc:creator>
      <dc:date>2011-03-31T10:32:53Z</dc:date>
    </item>
  </channel>
</rss>

