<?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 Re: URL of selected map service layer in TOC in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149958#M11623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;EM&gt;arcpy.mapping&lt;/EM&gt; module does not seem to expose this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you check the Layer properties the original name is shown (even after renaming it in the ToC):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="hurricanes.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/111004_hurricanes.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;However the documentation for the &lt;A href="https://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/layer-class.htm"&gt;arcpy.mapping Layer&lt;/A&gt; class shows no property that can be used to access this value unless you are using WMS service layers.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;serviceProperties&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="paramhint" style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;(Read Only)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;&lt;SPAN style="font-weight: bold;"&gt;Keys for a web service dictionary&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ServiceType —Property displaying the type of service. These include ImageServer, IMS, MapServer, TiledInternetLayer, WMS, and WCS.&lt;/LI&gt;&lt;LI&gt;URL —Property displaying the URL to the service. If the connection to ArcGIS for Server is through a local area network (LAN), this value will be null.&lt;/LI&gt;&lt;LI&gt;Server —Property displaying the server name. If the connection to ArcGIS for Server is through the Internet (HTTP), this value will be null.&lt;/LI&gt;&lt;LI&gt;UserName —Property displaying the user name used to access a secured service. If the service is not password protected, this property will be null.&lt;/LI&gt;&lt;LI&gt;ServiceName —IMS service layers only. Property displays the name of the IMS service.&lt;/LI&gt;&lt;LI&gt;WMSName —WMS service layers only. Property displays the text string for the WMS service used for machine-to-machine communication.&lt;/LI&gt;&lt;LI&gt;WMSTitle —WMS service layers only. Property displays the description title string for the WMS service.&lt;/LI&gt;&lt;LI&gt;Name —WMS service layers only. Property displays the text string for the WMS layer used for machine-to-machine communication.&lt;/LI&gt;&lt;LI&gt;Title —WMS service layers only. Property displays the description title string for the WMS layer.&lt;/LI&gt;&lt;/UL&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not sure if you can do this without heading down the ArcObjects path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jun 2015 03:40:26 GMT</pubDate>
    <dc:creator>OwenEarley</dc:creator>
    <dc:date>2015-06-18T03:40:26Z</dc:date>
    <item>
      <title>URL of selected map service layer in TOC</title>
      <link>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149955#M11620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using Python I'm trying to get the source path of a selected layer in ArcMap (10.3). The trouble I'm having is with layers from a AGS map service (10.0). I'm not getting the whole URL to the map service endpoint by using the layer class and serviceProperties. Any ideas of how to get the rest service endpoint of a selected layer in ArcMap?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tommy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 18:57:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149955#M11620</guid>
      <dc:creator>TommyStålnacke</dc:creator>
      <dc:date>2015-06-15T18:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: URL of selected map service layer in TOC</title>
      <link>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149956#M11621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following:&lt;/P&gt;&lt;P&gt;Open a new map document and add the Hurricanes map service:&lt;/P&gt;&lt;P&gt;&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open the python command prompt and run the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mapdoc = arcpy.mapping.MapDocument("CURRENT")
lyrs = arcpy.mapping.ListLayers(mapdoc)
for lyr in lyrs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("serviceProperties"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp = lyr.serviceProperties
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endpoint = "{0}/{1}/{2}".format(sp["URL"], lyr.name, sp["ServiceType"])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print endpoint&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should end up with the map service URL:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="map-service-url.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/110279_map-service-url.png" style="width: 620px; height: 164px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:06:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149956#M11621</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2021-12-11T08:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: URL of selected map service layer in TOC</title>
      <link>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149957#M11622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem though is when you rename the layer in ArcMap TOC. "lyr.name" then return the renamed layer name. So renaming the Hurricane map service gives me the following endpoint URL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://sampleserver6.arcgisonline.com/arcgis/services/renamed_layer/MapServer" rel="nofollow" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/services/&lt;STRONG&gt;renamed_layer&lt;/STRONG&gt;/MapServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tommy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 05:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149957#M11622</guid>
      <dc:creator>TommyStålnacke</dc:creator>
      <dc:date>2015-06-16T05:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: URL of selected map service layer in TOC</title>
      <link>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149958#M11623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;EM&gt;arcpy.mapping&lt;/EM&gt; module does not seem to expose this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you check the Layer properties the original name is shown (even after renaming it in the ToC):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="hurricanes.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/111004_hurricanes.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;However the documentation for the &lt;A href="https://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/layer-class.htm"&gt;arcpy.mapping Layer&lt;/A&gt; class shows no property that can be used to access this value unless you are using WMS service layers.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;serviceProperties&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="paramhint" style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;(Read Only)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;&lt;SPAN style="font-weight: bold;"&gt;Keys for a web service dictionary&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ServiceType —Property displaying the type of service. These include ImageServer, IMS, MapServer, TiledInternetLayer, WMS, and WCS.&lt;/LI&gt;&lt;LI&gt;URL —Property displaying the URL to the service. If the connection to ArcGIS for Server is through a local area network (LAN), this value will be null.&lt;/LI&gt;&lt;LI&gt;Server —Property displaying the server name. If the connection to ArcGIS for Server is through the Internet (HTTP), this value will be null.&lt;/LI&gt;&lt;LI&gt;UserName —Property displaying the user name used to access a secured service. If the service is not password protected, this property will be null.&lt;/LI&gt;&lt;LI&gt;ServiceName —IMS service layers only. Property displays the name of the IMS service.&lt;/LI&gt;&lt;LI&gt;WMSName —WMS service layers only. Property displays the text string for the WMS service used for machine-to-machine communication.&lt;/LI&gt;&lt;LI&gt;WMSTitle —WMS service layers only. Property displays the description title string for the WMS service.&lt;/LI&gt;&lt;LI&gt;Name —WMS service layers only. Property displays the text string for the WMS layer used for machine-to-machine communication.&lt;/LI&gt;&lt;LI&gt;Title —WMS service layers only. Property displays the description title string for the WMS layer.&lt;/LI&gt;&lt;/UL&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not sure if you can do this without heading down the ArcObjects path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 03:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149958#M11623</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2015-06-18T03:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: URL of selected map service layer in TOC</title>
      <link>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149959#M11624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I took your advice and headed down the ArcObjects path, and I found a soultion there. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 06:38:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/url-of-selected-map-service-layer-in-toc/m-p/149959#M11624</guid>
      <dc:creator>TommyStålnacke</dc:creator>
      <dc:date>2015-07-03T06:38:03Z</dc:date>
    </item>
  </channel>
</rss>

