<?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 Help with Deleting features from a View Layer in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870040#M4602</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I control a large database of Statewide data. I need to take the 'master' layer (a feature layer collection) and generate multiple child view layers for each county within the state. We use view layers so when we update the master layer, all the views will change with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Normally I can go into AGOL and do this one by one, by filtering the master by county, then saving each filtered layer independently. However there are 70 counties, and I don't want to do this by hand, and as I am learning Python, I decided to lean into it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It started well:&lt;/P&gt;&lt;P&gt;I could create county views from the master layer:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/410888_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could query each newly minted view layer by county&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/410889_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when I try to save the query to a new layer&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/410890_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok - more then one way skin the cat - I try to delete all the unwanted features from the original child view layer&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.esri.com/legacyfs/online/410891_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Feels like I am missing something fundamental here, but I admit to being stuck. Can anyone help?&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jun 2018 21:51:00 GMT</pubDate>
    <dc:creator>HowardKalnitz</dc:creator>
    <dc:date>2018-06-07T21:51:00Z</dc:date>
    <item>
      <title>Help with Deleting features from a View Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870040#M4602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I control a large database of Statewide data. I need to take the 'master' layer (a feature layer collection) and generate multiple child view layers for each county within the state. We use view layers so when we update the master layer, all the views will change with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Normally I can go into AGOL and do this one by one, by filtering the master by county, then saving each filtered layer independently. However there are 70 counties, and I don't want to do this by hand, and as I am learning Python, I decided to lean into it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It started well:&lt;/P&gt;&lt;P&gt;I could create county views from the master layer:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/410888_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could query each newly minted view layer by county&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/410889_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when I try to save the query to a new layer&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/410890_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok - more then one way skin the cat - I try to delete all the unwanted features from the original child view layer&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.esri.com/legacyfs/online/410891_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Feels like I am missing something fundamental here, but I admit to being stuck. Can anyone help?&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 21:51:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870040#M4602</guid>
      <dc:creator>HowardKalnitz</dc:creator>
      <dc:date>2018-06-07T21:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Deleting features from a View Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870041#M4603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you just need to set the layer's &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;viewDefinitionQuery&lt;/SPAN&gt;&amp;nbsp;value on each of the views. For example:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; FeatureLayerCollection

gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;username&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'user'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'pass'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
state_item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'STATE_ITEM_ID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
state_flc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; FeatureLayerCollection&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;fromitem&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;state_item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
state_flc_mgr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; state_flc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;manager

counties &lt;SPAN class="operator 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="punctuation token"&gt;.&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# setup a list of county names&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; county &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; counties&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; county_view &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; state_flc_mgr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;create_view&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;county&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; county_layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; county_view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; defn_str &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CountyName = '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;county&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; county_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;manager&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;update_definition&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"viewDefinitionQuery"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; defn_str&lt;SPAN class="punctuation token"&gt;}&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870041#M4603</guid>
      <dc:creator>J_R_Matchett</dc:creator>
      <dc:date>2021-12-12T10:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Deleting features from a View Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870042#M4604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks J.R. !&lt;/P&gt;&lt;P&gt;Sorry for the delay, but I got on this again last night, and after some manipulation of the SQL term, it worked beautifully!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jun 2018 13:10:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/help-with-deleting-features-from-a-view-layer/m-p/870042#M4604</guid>
      <dc:creator>HowardKalnitz</dc:creator>
      <dc:date>2018-06-23T13:10:58Z</dc:date>
    </item>
  </channel>
</rss>

