<?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 Spatial Data Frame: Accessing local GIS data in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793807#M1694</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/guide/introduction-to-the-spatial-dataframe/" title="https://developers.arcgis.com/python/guide/introduction-to-the-spatial-dataframe/"&gt;Introduction to the Spatial DataFrame | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This article mentions that a Spatial DataFrame can be created from a local feature class using the ArcGIS API for python:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"If the ArcPy module is installed, meaning you have installed ArcGIS Pro and have installed the ArcGIS API for Python in that same environment, the SpatialDataFrame has methods to read a subset of the ArcGIS Desktop supported geographic formats, most notably:&lt;BR /&gt;feature classes&lt;BR /&gt;shapefiles, &lt;BR /&gt;ArcGIS Server Web Services and ArcGIS Online Hosted Feature Layers &lt;BR /&gt;OGC Services "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The article goes through an example where they construct a SDF using a local path to a shape file, but I'd like to build a spatial dataframe from a feature layer coming from a map in a ArcGIS pro project.&amp;nbsp;Does anyone know how one could do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked into the documentation for the API. The arcgis.features module has the SpatialDataFrame object and a constructor method called "from_layer", but I am not sure how to pass a FeatureLayer object to it.&amp;nbsp; Is there a way to construct a FeatureLayer object from a local feature layer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to host the feature layer on AGOL and then create the spatial data frame from there, but I'd like to bypass having to host it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:07:30 GMT</pubDate>
    <dc:creator>BrentDavis</dc:creator>
    <dc:date>2020-09-29T20:07:30Z</dc:date>
    <item>
      <title>Spatial Data Frame: Accessing local GIS data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793807#M1694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/guide/introduction-to-the-spatial-dataframe/" title="https://developers.arcgis.com/python/guide/introduction-to-the-spatial-dataframe/"&gt;Introduction to the Spatial DataFrame | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This article mentions that a Spatial DataFrame can be created from a local feature class using the ArcGIS API for python:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"If the ArcPy module is installed, meaning you have installed ArcGIS Pro and have installed the ArcGIS API for Python in that same environment, the SpatialDataFrame has methods to read a subset of the ArcGIS Desktop supported geographic formats, most notably:&lt;BR /&gt;feature classes&lt;BR /&gt;shapefiles, &lt;BR /&gt;ArcGIS Server Web Services and ArcGIS Online Hosted Feature Layers &lt;BR /&gt;OGC Services "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The article goes through an example where they construct a SDF using a local path to a shape file, but I'd like to build a spatial dataframe from a feature layer coming from a map in a ArcGIS pro project.&amp;nbsp;Does anyone know how one could do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked into the documentation for the API. The arcgis.features module has the SpatialDataFrame object and a constructor method called "from_layer", but I am not sure how to pass a FeatureLayer object to it.&amp;nbsp; Is there a way to construct a FeatureLayer object from a local feature layer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to host the feature layer on AGOL and then create the spatial data frame from there, but I'd like to bypass having to host it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793807#M1694</guid>
      <dc:creator>BrentDavis</dc:creator>
      <dc:date>2020-09-29T20:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Data Frame: Accessing local GIS data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793808#M1695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/413084" target="_blank"&gt;Brent Davis&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#arcgis.features.SpatialDataFrame.from_featureclass" rel="nofollow noopener noreferrer" target="_blank"&gt;from_featureclass()&lt;/A&gt;&amp;nbsp;method - this one supports featureclass-like entities including shapefiles, and feature layers from a map in an ArcGIS Pro project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example&amp;nbsp;- running this code within an ArcGIS Pro session should create a spatial dataframe from the first layer in the first map of the current project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;arcpy

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
project_map &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&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="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; project_map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&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="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

sdf &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SpatialDataFrame&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;from_featureclass&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope that helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:08:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793808#M1695</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T09:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Data Frame: Accessing local GIS data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793809#M1696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/347957" target="_blank"&gt;Brent Davis&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;or you can use the most updated module called GeoAccessor&amp;nbsp; and GeoSeriesAccessor to achieve this:&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;features &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GeoAccessor&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; GeoSeriesAccessor
&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;import&lt;/SPAN&gt; pandas &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; pd
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; path to aprx&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
project_map &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"map name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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;
lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; project_map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"layer name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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;

sdf &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;DataFrame&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatial&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;from_featureclass&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;‌for more information about GeoAccessor refer to the link below:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html?highlight=geoaccessor#arcgis.features.GeoAccessor" title="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html?highlight=geoaccessor#arcgis.features.GeoAccessor" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis.features module — arcgis 1.8.2 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:08:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793809#M1696</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-12-12T09:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Data Frame: Accessing local GIS data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793810#M1697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome! Thank you. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2020 19:31:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793810#M1697</guid>
      <dc:creator>BrentDavis</dc:creator>
      <dc:date>2020-09-30T19:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Data Frame: Accessing local GIS data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793811#M1698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. Works beautifully.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2020 19:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/spatial-data-frame-accessing-local-gis-data/m-p/793811#M1698</guid>
      <dc:creator>BrentDavis</dc:creator>
      <dc:date>2020-09-30T19:31:34Z</dc:date>
    </item>
  </channel>
</rss>

