<?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 Object of type 'FeatureLayer' is not JSON serializable when trying to select features using a query in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/object-of-type-featurelayer-is-not-json/m-p/609734#M47603</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using ArcGIS API for Python, I'm attempting to build a script that selects only National Weather Service warning polygons from a feature layer in my AGOL organization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I brought in my AGOL Org feature layer containing all NWS weather alerts using this line:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;wwas = gis.content.search('title: Warnings', item_type="feature service", outside_org=False)[0]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Next I want to select only the warning polygons out of that layer, which are coded as 'W' in the "sig" field:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;warnings = find_existing_locations(wwas, "sig = 'W'", "only_NWS_warnings")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The error I get reads:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Object of type 'FeatureLayer' is not JSON serializable&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;At first I thought it was my query expression ("sig = 'W'"), but Python keeps referencing a&amp;nbsp;argument of the function called "context":&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;~\anaconda3\lib\site-packages\arcgis\features\find_locations.py&lt;/SPAN&gt; in &lt;SPAN class=""&gt;find_existing_locations&lt;/SPAN&gt;&lt;SPAN class=""&gt;(input_layers, expressions, output_name, context, gis)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;53&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expressions&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;54&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_name&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;---&amp;gt; 55&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context)&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;56&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;57&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Based on the documentation, context is an optional strong, so I'm not sure why it would pass an error when I've included the mandatory arguments (input_layers, expressions, output_name).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Apr 2018 14:52:32 GMT</pubDate>
    <dc:creator>KonradHughes</dc:creator>
    <dc:date>2018-04-09T14:52:32Z</dc:date>
    <item>
      <title>Object of type 'FeatureLayer' is not JSON serializable when trying to select features using a query</title>
      <link>https://community.esri.com/t5/python-questions/object-of-type-featurelayer-is-not-json/m-p/609734#M47603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using ArcGIS API for Python, I'm attempting to build a script that selects only National Weather Service warning polygons from a feature layer in my AGOL organization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I brought in my AGOL Org feature layer containing all NWS weather alerts using this line:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;wwas = gis.content.search('title: Warnings', item_type="feature service", outside_org=False)[0]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Next I want to select only the warning polygons out of that layer, which are coded as 'W' in the "sig" field:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;warnings = find_existing_locations(wwas, "sig = 'W'", "only_NWS_warnings")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The error I get reads:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Object of type 'FeatureLayer' is not JSON serializable&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;At first I thought it was my query expression ("sig = 'W'"), but Python keeps referencing a&amp;nbsp;argument of the function called "context":&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;~\anaconda3\lib\site-packages\arcgis\features\find_locations.py&lt;/SPAN&gt; in &lt;SPAN class=""&gt;find_existing_locations&lt;/SPAN&gt;&lt;SPAN class=""&gt;(input_layers, expressions, output_name, context, gis)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;53&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expressions&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;54&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_name&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;---&amp;gt; 55&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context)&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;56&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;57&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Based on the documentation, context is an optional strong, so I'm not sure why it would pass an error when I've included the mandatory arguments (input_layers, expressions, output_name).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2018 14:52:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/object-of-type-featurelayer-is-not-json/m-p/609734#M47603</guid>
      <dc:creator>KonradHughes</dc:creator>
      <dc:date>2018-04-09T14:52:32Z</dc:date>
    </item>
  </channel>
</rss>

