Pass SEDF as feature class into arcpy geoprocessing tools

719
5
12-08-2021 09:15 AM
TylerT
by
Occasional Contributor III

Is there a way to pass a spatially enabled dataframe (SEDF) as a feature class (in or out) into arcpy geoprocessing tools?  This would eliminate the need to unnecccearily write to feature classes to to disk.  

For example:

in_features = sdf_in
out_feature_class = sdf_out

arcpy.analysis.Buffer(in_features, out_feature_class, buffer_distance_or_field, {line_side}, {line_end_type}, {dissolve_option}, {dissolve_field}, {method})

-- OR --
target_features = sdf_1
join_features = sdf_2
out_feature_class = sdf_out

arcpy.analysis.SpatialJoin(target_features, join_features, out_feature_class, {join_operation}, {join_type}, {field_mapping}, {match_option}, {search_radius}, {distance_field_name})

GeoSeriesAccessor as_arcpy holds some promise, but only accepts a series, so I'm struggling to see how to carry this out.

 Thank you,

Tyler

0 Kudos
5 Replies
DanPatterson
MVP Esteemed Contributor

no, it needs to be converted you can always delete it later

you can see if there is a workaround using the api directly

API Reference for the ArcGIS API for Python — arcgis 1.9.1 documentation


... sort of retired...
0 Kudos
TylerT
by
Occasional Contributor III

In the ArcGIS API docs it is difficult to discern what method, if any accepts SEDFs besides GeoAccessor and GeoSeriesAccessor, which I am relatively comfortable with.

0 Kudos
DanPatterson
MVP Esteemed Contributor

from your multiple posts, it appears that you are trying to emulate Pro functionality without using Pro tools.  Arcpy is limited when used in the python api.  the geoprocessing functionality uses either arcpy or shapely and since arcpy's exposure is limited and shapely isn't a replacement for arcpy's capabilities, you are sort of stuck


... sort of retired...
0 Kudos
TylerT
by
Occasional Contributor III

I'm not necessarily stuck.  I can get a lot done with a SEDF, just trying to see where the left and right bounds are.

0 Kudos
DanPatterson
MVP Esteemed Contributor

examining the code in

C:\_Your_Install_folder_\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis

will give you a good idea how everything is pieced together and what is available and what is not


... sort of retired...
0 Kudos