Spatial Enable DataFrame

249
5
12-01-2021 03:39 PM
FrankAwuah-Antwi
New Contributor II

FrankAwuahAntwi_0-1638401621293.png

How do I Spatial Enable my dataframe with the geometry(Polygon) instead of the from_xy ultilizing the latlon which gives me point data instead of the polygon data I am after.

0 Kudos
5 Replies
BrianWilson7
Regular Contributor

If you already have a feature class of type polygon you could load it, then you'd have the polygon type and attributes defined for you.  The feature class could be empty.

Capture.PNG

 

0 Kudos
FrankAwuah-Antwi
New Contributor II

Thanks Brian for the help. I have try your solution but still needs some help to get it working. I am able to create the point data but really need to get it out as polygon using the geometry column. Have attached the image of the error. Thank for the support.

Capture.PNG

0 Kudos
AtmaMani
Esri Contributor

Brian's answer above is a good workflow.

But if for some reason, your workflow involves reading the data first into a `data_df`, then you can use the `from_df()` method. Please see: https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#arcgis.features.GeoAcces....

You can then pass the `geometry` column in your screenshot to the `geometry_column` argument.

We are rewriting the SeDF guide doc. The parts 2 and 3 talk about data IO extensively. At the moment it is in draft form here: https://github.com/Esri/arcgis-python-api/pull/1125. You are welcome to check it out and share feedback.

0 Kudos
FrankAwuah-Antwi
New Contributor II

Thanks AtmaMani for the help. I have try your solution but still needs some help to get it working. I am able to create the point data but really need to get it out as polygon using the geometry column. Have attached the image of the error. Thank for the support.

Capture.PNG

0 Kudos
BrianWilson7
Regular Contributor

It sounds like you have a collection of points and you are trying to convert them into polygons?

How are the points in your CSV related -- are the all part of one polygon? Can you use a convex hull to make them into a polygon? Or some other function... this is the time when we say "exactly what do you need to end up with?"

https://pro.arcgis.com/en/pro-app/2.8/tool-reference/data-management/minimum-bounding-geometry.htm

If you don't have access to desktop ArcGIS to use arcpy there is also a thing called "GeoPandas".

0 Kudos