<?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: How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843684#M3615</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where did the dataframe come from?&amp;nbsp; Was it loaded from a service, feature class, etc...?&amp;nbsp; Instead of converting a SpatialDataFrame to a Spatially-enabled DataFrame, why not just work with a spatially-enabled dataframe from the start of your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2020 18:02:05 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-05-07T18:02:05Z</dc:date>
    <item>
      <title>How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843683#M3614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The most straightfoward thing is elusive:&lt;/P&gt;&lt;P&gt;All I want to do is create a spatially enable dataframe from an existing dataframe with a SHAPE column containing the respective arcpy Geometry objects.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can create a SpatialDataFrame (deprecated apparently)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from arcpy.features import SpatialDataFrame&lt;/P&gt;&lt;P&gt;sdf = SpatialDataFrame(df, geometry='SHAPE').&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works, but in 1.5, I can't export to a feature class - I get the following error:&amp;nbsp;&lt;STRONG&gt;The following rows could not be written to the table: 0,1,2,3........&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So apparently I need to use a spatially enabled dataframe, but haven't figured out how to create one similar to above.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sdf = pd.DataFrame.spaital.from_df(df, geometry='SHAPE') doesn't work - error says got an unexpected argument geometry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sdf = pd.DataFrame.spaital.from_df(df) throws the error Address column not found in dataframe.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone figured this out?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2020 17:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843683#M3614</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2020-05-07T17:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843684#M3615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where did the dataframe come from?&amp;nbsp; Was it loaded from a service, feature class, etc...?&amp;nbsp; Instead of converting a SpatialDataFrame to a Spatially-enabled DataFrame, why not just work with a spatially-enabled dataframe from the start of your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2020 18:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843684#M3615</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-05-07T18:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843685#M3616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The dataframe is constructed from a variety of sources: csvs, other dataframes, shapefiles.&amp;nbsp; After all the joining, merging, etc. etc., I get a dataframe back.&amp;nbsp; Anyway, it seems that if you have a SHAPE field in the dataframe, it just works:&lt;/P&gt;&lt;P&gt;sdf = pd.DataFrame.spatial(df) #df has SHAPE field with geometry objects - don't know how this would work with a different field name&lt;/P&gt;&lt;P&gt;sdf.to_featureclass(mylocation)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2020 19:47:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/843685#M3616</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2020-05-07T19:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/1041091#M5822</link>
      <description>&lt;P&gt;What if my workflow is&lt;/P&gt;&lt;P&gt;1. Create new empty SEDF&lt;/P&gt;&lt;P&gt;2. Populate it&lt;/P&gt;&lt;P&gt;3. Save it&lt;/P&gt;&lt;P&gt;I need the equivalent of "df = SEDF()". At the moment it seems like the workflow needs to be something clumsily hacky like&lt;/P&gt;&lt;P&gt;1. Load an existing dataset as an SEDF&lt;/P&gt;&lt;P&gt;2. Empty it&lt;/P&gt;&lt;P&gt;3 Refill it&lt;/P&gt;&lt;P&gt;4 Save it&lt;/P&gt;&lt;P&gt;If I try to create a pd.DataFrame() and copy shapes into it and then write it out with to_featureclass&amp;nbsp; it tells me to use "set_geometry" and if I do that then it fails.&lt;/P&gt;&lt;P&gt;Sometimes it tells me not to use SpatialDataFrames because they are deprecated, yet type(points) shows the dataset is a GeoAccessor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 15:52:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/1041091#M5822</guid>
      <dc:creator>BrianWilson</dc:creator>
      <dc:date>2021-03-26T15:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/1041187#M5824</link>
      <description>&lt;P&gt;Like everything else I've been trying, this almost works.&lt;/P&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;pandas&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;pd&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;arcgis.geometry&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;Point&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;p&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;Point({&lt;/SPAN&gt;&lt;SPAN&g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t;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;4326&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df.spatial.validate(strict=True)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df.spatial.to_featureclass(location="points.shp")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;SPAN&gt;It fails complaining about not having a spatial reference, though it's set in the "set_geometry".&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Note the Esri documentation error which says set_geometry returns a new DF, it does not. If you specify the "inplace=True" option, that fails with an error that there is no such option. The default, to return a new DF, is not true. It returns nothing.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If I check the property "geometry" before doing set_geometry, it says "SHAPE" so that's set internally.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;There does not appear to be any property or method to check to see what spatial reference is set on the DF, for example "df.spatial.sr" or "df.spatial.info()" so I have no way to see if set_geometry "sr" option does anything at all.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 Mar 2021 19:26:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/1041187#M5824</guid>
      <dc:creator>BrianWilson</dc:creator>
      <dc:date>2021-03-26T19:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a SpatiallyEnabledDataFrame from an existing dataframe with a SHAPE colunmn?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/1041190#M5825</link>
      <description>&lt;P&gt;If the "ArcGIS API for Python" were an opensource project, it would be version &amp;lt; 1 -- then I'd find it more acceptable and cut some slack.&amp;nbsp; Missing properties, missing methods, documentation errors... I'd just fix some of these and issue pull requests &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I issue a bug report it will be assigned some value like "3" and then Esri will say "we never fix anything with a priority below 1000". Or it will be changed from "bug" to "feature will not be implemented" and closed.&lt;/P&gt;&lt;P&gt;I certainly would run away from today if there were an alternative. I am thinking of trying geopandas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 19:33:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-a-spatiallyenableddataframe-from-an/m-p/1041190#M5825</guid>
      <dc:creator>BrianWilson</dc:creator>
      <dc:date>2021-03-26T19:33:20Z</dc:date>
    </item>
  </channel>
</rss>

