Overwriting Hosted Feature layer WITHOUT using Project file

334
3
07-26-2023 03:47 AM
NielsPerfectPlace
New Contributor III

Hello. I need to overwrite a hosted feature layer using a Feature Class from a File Geodatabase using python. I cannot use a project file, because I haven't used one to create the feature classes to begin with. 

I need to use the exact same settings in the Service Definition. 

I can't really figure out how to do this. 

If anybody has an idea I would appreciate it. 

0 Kudos
3 Replies
DonMorrison1
Occasional Contributor III

I'm not sure if this will help, but I quite often need to create aprx files in my python code. The only way I've figured out is to use ArcGIS Pro to create an empty project and store it in the local file system where the python code can find it. The python code makes a copy of the aprx file then starts filling in the copy with maps layers or whatever.

0 Kudos
NielsPerfectPlace
New Contributor III

Thanks for your reply. That's also what I'm trying now.

I can't seem to figure out how to properly overwrite the online layer though. I want to keep as many settings and information as possible, basically just copying what "Overwrite web layer" does in ArcGIS Pro. 

0 Kudos
JakeSkinner
Esri Esteemed Contributor

@NielsPerfectPlace this script may give you what you need.

0 Kudos