<?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 Publishing spatial dataframe to featurelayer bug? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1351820#M9317</link>
    <description>&lt;P&gt;I'm getting a strange error when trying to publish to AGOL a geodataframe that has been converted to a spatial dataframe.&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_featurelayer() produces the error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;UnboundLocalError&lt;/SPAN&gt;: local variable 'file' referenced before assignment&lt;/PRE&gt;&lt;P&gt;The error appears to be in the arcgis\gis\_impl\_content_manager\_import_data.py file.&lt;BR /&gt;&lt;BR /&gt;_create_file_item() method passes in a dataframe argument (df) but the method is written so that it looks specifically for gdb, shapefiles, or csv's. It does not know how to handle a dataframe object and never creates the tempfile to store the data so when it tries to reference 'file' later on, there is no file and it crashes.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="31337_0-1700541875810.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86654i013333F35CE2F038/image-size/medium?v=v2&amp;amp;px=400" role="button" title="31337_0-1700541875810.png" alt="31337_0-1700541875810.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I have not been able to use:&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_featureset()&lt;BR /&gt;&lt;BR /&gt;or&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_feature_collection()&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_featureclass()&lt;BR /&gt;&lt;BR /&gt;They are all broken.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does anyone have a way to publish a geodataframe or spatial dataframe to AGOL using the API?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 04:49:54 GMT</pubDate>
    <dc:creator>31337</dc:creator>
    <dc:date>2023-11-21T04:49:54Z</dc:date>
    <item>
      <title>Publishing spatial dataframe to featurelayer bug?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1351820#M9317</link>
      <description>&lt;P&gt;I'm getting a strange error when trying to publish to AGOL a geodataframe that has been converted to a spatial dataframe.&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_featurelayer() produces the error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;UnboundLocalError&lt;/SPAN&gt;: local variable 'file' referenced before assignment&lt;/PRE&gt;&lt;P&gt;The error appears to be in the arcgis\gis\_impl\_content_manager\_import_data.py file.&lt;BR /&gt;&lt;BR /&gt;_create_file_item() method passes in a dataframe argument (df) but the method is written so that it looks specifically for gdb, shapefiles, or csv's. It does not know how to handle a dataframe object and never creates the tempfile to store the data so when it tries to reference 'file' later on, there is no file and it crashes.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="31337_0-1700541875810.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86654i013333F35CE2F038/image-size/medium?v=v2&amp;amp;px=400" role="button" title="31337_0-1700541875810.png" alt="31337_0-1700541875810.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I have not been able to use:&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_featureset()&lt;BR /&gt;&lt;BR /&gt;or&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_feature_collection()&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;sdf.spatial.to_featureclass()&lt;BR /&gt;&lt;BR /&gt;They are all broken.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does anyone have a way to publish a geodataframe or spatial dataframe to AGOL using the API?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 04:49:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1351820#M9317</guid>
      <dc:creator>31337</dc:creator>
      <dc:date>2023-11-21T04:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing spatial dataframe to featurelayer bug?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1364746#M9462</link>
      <description>&lt;P&gt;Hi - just to clarify, are you attempting this process?&lt;/P&gt;&lt;P&gt;GeoPandas GeoDataFrame &amp;gt; Spatially Enabled DataFrame &amp;gt; Hosted feature layer in AGOL?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 15:47:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1364746#M9462</guid>
      <dc:creator>NicholasGiner1</dc:creator>
      <dc:date>2023-12-28T15:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing spatial dataframe to featurelayer bug?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1387569#M9693</link>
      <description>&lt;P&gt;Why did you post a reply to this if you never bothered to produce a suggested solution?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 17:11:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-spatial-dataframe-to-featurelayer-bug/m-p/1387569#M9693</guid>
      <dc:creator>FEMARegion_II</dc:creator>
      <dc:date>2024-02-27T17:11:33Z</dc:date>
    </item>
  </channel>
</rss>

