Select to view content in your preferred language

Spatial Enable DataFrame to Enterprise GeoDatabase (EGDB) (.sde)

624
3
03-25-2024 12:49 PM
TylerT
by
Frequent Contributor

Hello,

I'm attempting to write a spatially enabled dataframe to an SQL Server Enterprise Geodatabase with the sedf.spatial.to_featureclass(location) method.   It's not clear to me what I need to pass as the location parameter when dealing with an EGDB. 

There doesn't seem to be any mention of exporting sedfs to EGDB feature classes on this page https://developers.arcgis.com/python/guide/part3-data-io-writing-data/, rather only mention of exporting to feature layer.

Any pointers would be appreciated.

Tyler

ArcGIS Enterprise 11.2
ArcGIS Pro 3.2.0

 

0 Kudos
3 Replies
Clubdebambos
MVP Regular Contributor

Hi @TylerT 

It would be useful to see what you have attempted and the error(s) you are getting.

 

~ learn.finaldraftmapping.com
0 Kudos
TylerT
by
Frequent Contributor

Hello.  Thanks for the response.  This is the error I'm getting:

 

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Feature Class Location: Dataset Z:\dir\...\db.sde does not exist or is not supported
Failed to execute (CreateFeatureclass).

 

The location was captured from ArcGIS Pro > Catalog > Databases > select Enterprise Connection > Copy Path...

TylerT_0-1711475353441.png

Interestingly, the same path works just fine for arcpy tools such as arcpy.management.CreateFeatureclass(), and other management tools...  

arcpy.env.workspace = r"Z:\dir\...\db.sde"
arcpy.management.CreateFeatureclass(<args>)
#This works!



My working theories are:
1) There is an added nuance in the path that I'm not seeing in the docs?,
2) The geoaccessor namespace sedf.spatial.to_featureclass(location) method requires the more complex connection string rather than a simple path (I haven't been able to test this yet, b/c I'm also troubleshooting arcpy.management.CreateDatabaseConnectionString() in a separate post since this issue is independent)?
3) It's not possible to write to SEDF to EGDB (seems unlikely, but then again, why is it not mentioned in i/o post https://developers.arcgis.com/python/guide/part3-data-io-writing-data/)?

Any thoughts?

Tyler
Enterprise 11.2
ArcGIS Pro 3.2.0

0 Kudos
TylerT
by
Frequent Contributor

Hello,
I broke through the barrier.  It is possible to write to EDGBs using GeoAccessor sedf.spatial.to_featureclass(location).  The location parameter is a string and takes a similar form as writing to a gdb (e.g. r"Z:\some_dir\...\db.sde\wetlands").  I'm not exactly sure what issue I was having.  When viewing the Enterprise Database Connection in ArcGIS Pro there was an exclamation point near the connection, so I restarted my PC, removed and replaced the connection from the APRX, then it worked.

Tyler

0 Kudos