ArcGIS API for Python - Spatially Enabled DataFrame from WKT Geometry

08-26-2020 08:57 AM
New Contributor II

I am working in a jupyter notebook, trying to query a SQL database via pyodbc and turn the output data into a spatially enabled dataframe. I can successfully read my SQL query as a regular pandas dataframe, including a column with the geometry as WKT. 

Can one manually add a SHAPE column (of properly converted geometry WKT into Geometry objects) to an existing pandas dataframe to create a spatially enabled dataframe?

Another way to phrase this would be, can one create a spatially enabled dataframe starting with geometry as WKT? I'm working with polygon data, so from_xy() would not work. A similar question posed in 2018 suggests not without some clunky workarounds via outside libraries (shapely, geojson).

0 Replies