<?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: Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject' in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211271#M16317</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/339735"&gt;Arne Gelfert&lt;/A&gt;‌I don't know offhand since I am usually working with data I create myself... so everything is perfect of course &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;.&lt;/P&gt;&lt;P&gt;If you get a list of layers that don't work, you may be able to determine some communalities between them... assuming that there isn't some random or obscure bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Sep 2020 22:48:55 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-09-24T22:48:55Z</dc:date>
    <item>
      <title>Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject'</title>
      <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211267#M16313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What determines whether an arcpy map layer that was created as part of a created created using ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ConvertWebMapToArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;WEB_MAP_AS_JSON&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;can be turned off? I'm creating a&amp;nbsp;map from the above...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject
mymap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But when I try turn layers invisible, I get this for some:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;The attribute 'visible' is not supported on this instance of Layer.&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The layers all derive from a Portal&amp;nbsp;webmap so that they have...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isWebLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Most of my layers don't have that issue and wilingly switch to :&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt; Success&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is this limitation based on a setting in the webmap or in the underlying map services (item) ? Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211267#M16313</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-12-11T10:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject'</title>
      <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211268#M16314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So to refine my approach after re-reading the documentation on layer properties and methods, I try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# ... while iterating over layers&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Layer Name: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Layer visible: "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Layer supports 'visible': "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"visible"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"visible"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
      layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; !layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible
      &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Switched Layer visibility"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Unable to switch visibility"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;e&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Layer visible: "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On most cases, there result is as expected:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Layer Name: My Well Behaved Layer
Layer visible: True
Layer supports 'visible':  True
Switched Layer visibility
Layer visible: False‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But in other cases, I get this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Layer Name: My Poorly Behaved Layer
Layer visible: True
Layer supports 'visible':  True
Unable to switch visibility
The attribute 'visible' is not supported on this instance of Layer.
Layer visible: True‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It seems that it the layer says it supports 'visible', it should do so. Would love to know how to make sense of this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211268#M16314</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-12-11T10:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject'</title>
      <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211269#M16315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;line 8&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;layer&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; !layer&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;visible&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is that =! a formatting or copy issue?&amp;nbsp; (ie space between =, ! and lack of space between ! and layer...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A shortcut perhaps, but&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case = not case&amp;nbsp; # ie.&amp;nbsp; layer.visible = not layer.visible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is a little less prone to format issues and misinterpretation&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2020 20:57:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211269#M16315</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-09-24T20:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject'</title>
      <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211270#M16316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry ,,,&amp;nbsp;never a good idea&amp;nbsp;to tweak things in transition from IDE to Geonet... I'm flipping the attribute&amp;nbsp;to its Boolean opposite, so it should read:&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;layer&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit; font-size: 14px;"&gt;=&lt;/SPAN&gt; not layer&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;.&lt;/SPAN&gt;visible&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If it was visible to begin with, I want to hide it, and the other around. Any idea why this would fail for some layers? Thanks, Dan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2020 21:26:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211270#M16316</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-09-24T21:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject'</title>
      <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211271#M16317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/339735"&gt;Arne Gelfert&lt;/A&gt;‌I don't know offhand since I am usually working with data I create myself... so everything is perfect of course &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;.&lt;/P&gt;&lt;P&gt;If you get a list of layers that don't work, you may be able to determine some communalities between them... assuming that there isn't some random or obscure bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:48:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211271#M16317</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-09-24T22:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Layer.visible property when using 'arcpy.mp.ConvertWebMapToArcGISProject'</title>
      <link>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211272#M16318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I'm stumped on this one. I've gone ahead and republished my map service in question here, and now I'm seeing even weirder behavior. But since it doesn't&amp;nbsp;merely relate to the 'visible' property, I'll start a new thread. Thanks for chiming in, Dan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:56:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-visible-property-when-using-arcpy-mp/m-p/211272#M16318</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-09-29T20:56:59Z</dc:date>
    </item>
  </channel>
</rss>

