Looking at the SpatialDataFrame documentation:
staticfrom_layer(layer, **kwargs)
Returns a SpatialDataFrame from a FeatureLayer or Table object. Inputs:
| param layer: | FeatureLayer or Table |
|---|
| param gis: | GIS object |
|---|
Returns a SpatialDataFrame
However, I see something different when using a Table object:
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> tbl_url <SPAN class="operator token">=</SPAN> <SPAN class="comment token"># URL to AGOL table</SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> tbl <SPAN class="operator token">=</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>features<SPAN class="punctuation token">.</SPAN>Table<SPAN class="punctuation token">(</SPAN>tbl_url<SPAN class="punctuation token">)</SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> type<SPAN class="punctuation token">(</SPAN>tbl<SPAN class="punctuation token">)</SPAN>
<SPAN class="operator token"><</SPAN><SPAN class="keyword token">class</SPAN> <SPAN class="string token">'arcgis.features.layer.Table'</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> SDF <SPAN class="operator token">=</SPAN> SpatialDataFrame<SPAN class="punctuation token">.</SPAN>from_layer<SPAN class="punctuation token">(</SPAN>tbl<SPAN class="punctuation token">)</SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> type<SPAN class="punctuation token">(</SPAN>SDF<SPAN class="punctuation token">)</SPAN>
<SPAN class="operator token"><</SPAN><SPAN class="keyword token">class</SPAN> <SPAN class="string token">'pandas.core.frame.DataFrame'</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
So, passing a table returns a DataFrame, even though the documentation says a SpatialDataFrame is returned. Even more interesting are the methods and properties of this "DataFrame":
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> SDF_attrs <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'copy'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'erase'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'from_featureclass'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'from_hdf'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'from_layer'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'geoextent'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'geometry'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'merge_datasets'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'plot'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'reproject'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'select_by_location'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'set_geometry'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'to_featureclass'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'to_featurelayer'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'to_featureset'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'to_hdf'</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="keyword token">for</SPAN> attr <SPAN class="keyword token">in</SPAN> SDF_attrs<SPAN class="punctuation token">:</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>attr<SPAN class="punctuation token">,</SPAN> hasattr<SPAN class="punctuation token">(</SPAN>SDF<SPAN class="punctuation token">,</SPAN> attr<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
copy <SPAN class="token boolean">True</SPAN>
erase <SPAN class="token boolean">False</SPAN>
from_featureclass <SPAN class="token boolean">False</SPAN>
from_hdf <SPAN class="token boolean">False</SPAN>
from_layer <SPAN class="token boolean">False</SPAN>
geoextent <SPAN class="token boolean">False</SPAN>
geometry <SPAN class="token boolean">False</SPAN>
merge_datasets <SPAN class="token boolean">False</SPAN>
plot <SPAN class="token boolean">True</SPAN>
reproject <SPAN class="token boolean">False</SPAN>
select_by_location <SPAN class="token boolean">False</SPAN>
set_geometry <SPAN class="token boolean">True</SPAN>
to_featureclass <SPAN class="token boolean">False</SPAN>
to_featurelayer <SPAN class="token boolean">False</SPAN>
to_featureset <SPAN class="token boolean">False</SPAN>
to_hdf <SPAN class="token boolean">True</SPAN>
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I can understand some of these because there is both a pandas DataFrame version and ArcGIS SpatialDataFrame version of the property/method, but why is set_geometry showing up?