<?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: Creating View Layer Problem in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-view-layer-problem/m-p/1548708#M10772</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/796464"&gt;@Pukawai&lt;/a&gt;&amp;nbsp;- Can you please contact Esri Support so we can try to reproduce this onsite and investigate further?&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2024 15:51:54 GMT</pubDate>
    <dc:creator>JohnYaist1</dc:creator>
    <dc:date>2024-10-15T15:51:54Z</dc:date>
    <item>
      <title>Creating View Layer Problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-view-layer-problem/m-p/1524593#M10450</link>
      <description>&lt;P&gt;I'm trying to create some View layers using code I found here but am having some problems.&lt;/P&gt;&lt;P&gt;The code below runs without errors and creates the View Layer, but if I try to add the layer to a map I get the incredibly useful error "An error occurred loading this layer". Further investigation revealed that the View Layer's item details does not list any layers even though the code says there is one.&lt;/P&gt;&lt;P&gt;I can create a view layer manually using the same feature layer and it works fine and does list the layer in the view layer's item details.&lt;/P&gt;&lt;P&gt;I've commented out the portion of the code that adds a definition query as it does not seem to be relevant to the problem. Any insights as to what's going on here would be greatly appreciated.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;from arcgis import GIS
from arcgis.features import FeatureLayerCollection
gis = GIS('https://www.arcgis.com', 'USER', 'PWD')

sourceLayer = "Overhead"
source_search = gis.content.search(sourceLayer)
for s in source_search:
    if(s.title == sourceLayer and s.type == "Feature Service"):
        source_flc = FeatureLayerCollection.fromitem(s)
        print(s)
        # Create View from Source Hosted Feature Layer
        new_view = source_flc.manager.create_view(name="ThreePhaseOH")
        view_flc = FeatureLayerCollection.fromitem(new_view)
        print(len(view_flc.layers))
#        view_layer = view_flc.layers[0]
#        view_def = {"viewDefinitionQuery" : "(wmBaseKv &amp;gt;= 2.4) AND (wmBaseKv &amp;lt; 2.5)"}
#        view_layer.manager.update_definition(view_def)
        print(new_view)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 18:13:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-view-layer-problem/m-p/1524593#M10450</guid>
      <dc:creator>Pukawai</dc:creator>
      <dc:date>2024-08-20T18:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating View Layer Problem</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-view-layer-problem/m-p/1548708#M10772</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/796464"&gt;@Pukawai&lt;/a&gt;&amp;nbsp;- Can you please contact Esri Support so we can try to reproduce this onsite and investigate further?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 15:51:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-view-layer-problem/m-p/1548708#M10772</guid>
      <dc:creator>JohnYaist1</dc:creator>
      <dc:date>2024-10-15T15:51:54Z</dc:date>
    </item>
  </channel>
</rss>

