Die meisten Inhalte (Feature-Services, Karten) können mit dem ArcGIS Online Assistant<\/A> kopiert werden. Die unten beschriebene Python-Methode ist für komplexere Inhalte erforderlich. Sie können sie für Dashboards, Web-Apps, Umfragen und konfigurierbare Apps verwenden. Sie funktioniert nicht für ArcGIS StoryMaps oder ArcGIS Experience Builder.<\/P><\/P>
<\/P>
username =<\/SPAN> input(<\/SPAN>"Benutzernamen der Ursprungsorganisation eingeben: "<\/SPAN>)<\/SPAN>from<\/SPAN> arcgis.<\/SPAN>gis import<\/SPAN> GISgis1 =<\/SPAN> GIS(<\/SPAN>"https:\/\/arcgis.com"<\/SPAN>,<\/SPAN> username)<\/SPAN><\/SPAN><\/SPAN><\/SPAN><\/SPAN><\/CODE><\/PRE>10. Klicken Sie auf Ausführen<\/STRONG>.<\/P><\/P>11. Geben Sie im erscheinenden Textfeld Ihren Benutzernamen ein und drücken Sie Eingabe<\/EM><\/STRONG>.<\/P>12. Geben Sie im Textfeld Kennwort eingeben<\/STRONG> Ihr Passwort ein und drücken Sie Eingabe<\/EM><\/STRONG>.<\/P>Als Nächstes verbinden Sie sich mit Ihrem Ziel-<\/EM>-ArcGIS-Konto – dem Konto, in das Sie Ihre Inhalte verschieben möchten.<\/P>13. Fügen Sie in der nächsten Zelle folgenden Text ein:<\/P>username_2 =<\/SPAN> input(<\/SPAN>"Benutzernamen der Zielorganisation eingeben: "<\/SPAN>)<\/SPAN>gis2 =<\/SPAN> GIS(<\/SPAN>"https:\/\/arcgis.com"<\/SPAN>,<\/SPAN> username_2)<\/SPAN><\/SPAN><\/SPAN><\/SPAN><\/CODE><\/PRE>14. Klicken Sie auf Ausführen<\/STRONG>.<\/P>15. Geben Sie den Benutzernamen und das Kennwort Ihres Zielkontos ein.<\/P> <\/P>Schließlich identifizieren Sie das/die Element(e), das/die Sie übertragen möchten, und kopieren es/sie in Ihr Zielkonto.<\/H6>16. Geben Sie in der nächsten Zelle folgenden Text ein, führen den Code aber noch nicht aus.<\/P>items =<\/SPAN> gis1.<\/Spancontentcontentcontent>.search(query= tab und überprüfen Sie, ob das Element kopiert wurde. Wenn Sie sich bereits auf der Content-Seite befanden, aktualisieren Sie Ihren Browser, um die Änderungen zu sehen.<\/P>Wenn Sie ein Element kopieren, das von anderen Elementen abhängt, sollten alle Elemente mitkopiert werden. Im folgenden Beispiel habe ich nur TestDashboard verschoben. Test Map und Test_Data wurden ebenfalls kopiert.<\/P><\/P>Wenn Sie nicht möchten, dass dies passiert, setzen Sie copy_data=False <\/EM> im obigen Code.<\/P><\/P>Sie können hier mehr über die clone_items-Funktion lesen: https:\/\/developers.arcgis.com\/python\/api-reference\/arcgis.gis.toc.html#arcgis.gis.ContentManager.clone_items<\/A><\/P> <\/P>
username_2 =<\/SPAN> input(<\/SPAN>"Benutzernamen der Zielorganisation eingeben: "<\/SPAN>)<\/SPAN>gis2 =<\/SPAN> GIS(<\/SPAN>"https:\/\/arcgis.com"<\/SPAN>,<\/SPAN> username_2)<\/SPAN><\/SPAN><\/SPAN><\/SPAN><\/CODE><\/PRE>14. Klicken Sie auf Ausführen<\/STRONG>.<\/P>15. Geben Sie den Benutzernamen und das Kennwort Ihres Zielkontos ein.<\/P> <\/P>Schließlich identifizieren Sie das/die Element(e), das/die Sie übertragen möchten, und kopieren es/sie in Ihr Zielkonto.<\/H6>16. Geben Sie in der nächsten Zelle folgenden Text ein, führen den Code aber noch nicht aus.<\/P>items =<\/SPAN> gis1.<\/Spancontentcontentcontent>.search(query= tab und überprüfen Sie, ob das Element kopiert wurde. Wenn Sie sich bereits auf der Content-Seite befanden, aktualisieren Sie Ihren Browser, um die Änderungen zu sehen.<\/P>Wenn Sie ein Element kopieren, das von anderen Elementen abhängt, sollten alle Elemente mitkopiert werden. Im folgenden Beispiel habe ich nur TestDashboard verschoben. Test Map und Test_Data wurden ebenfalls kopiert.<\/P><\/P>Wenn Sie nicht möchten, dass dies passiert, setzen Sie copy_data=False <\/EM> im obigen Code.<\/P><\/P>Sie können hier mehr über die clone_items-Funktion lesen: https:\/\/developers.arcgis.com\/python\/api-reference\/arcgis.gis.toc.html#arcgis.gis.ContentManager.clone_items<\/A><\/P> <\/P>
items =<\/SPAN> gis1.<\/Spancontentcontentcontent>.search(query= tab und überprüfen Sie, ob das Element kopiert wurde. Wenn Sie sich bereits auf der Content-Seite befanden, aktualisieren Sie Ihren Browser, um die Änderungen zu sehen.<\/P>Wenn Sie ein Element kopieren, das von anderen Elementen abhängt, sollten alle Elemente mitkopiert werden. Im folgenden Beispiel habe ich nur TestDashboard verschoben. Test Map und Test_Data wurden ebenfalls kopiert.<\/P><\/P>Wenn Sie nicht möchten, dass dies passiert, setzen Sie copy_data=False <\/EM> im obigen Code.<\/P><\/P>Sie können hier mehr über die clone_items-Funktion lesen: https:\/\/developers.arcgis.com\/python\/api-reference\/arcgis.gis.toc.html#arcgis.gis.ContentManager.clone_items<\/A><\/P> <\/P>
items =<\/SPAN> gis1.<\/SPAN>content.<\/SPAN>search(<\/SPAN>query=<\/SPAN>"owner: {}"<\/SPAN>.<\/SPAN>format(<\/SPAN>username)<\/SPAN>, <\/SPAN>max_items=<\/SPAN>num_items, <\/SPAN>sort_field=<\/SPAN>'id'<\/SPAN>, <\/SPAN>sort_order=<\/SPAN>'desc'<\/SPAN>)<\/SPAN>items<\/SPAN><\/SPAN><\/SPAN><\/CODE><\/PRE>2. Führen Sie die Zelle erneut aus. Es wird Sie fragen, wie viele Elemente Sie kopieren möchten.<\/P>3. Führen Sie die letzte Zelle erneut aus, um den Inhalt zu kopieren.<\/P><\/P>Weitere Möglichkeiten zur Suche nach Elementen finden Sie im Search reference<\/A>-Dokument.<\/P> <\/P>
Thanks for this @HeatherSmith
I successfully cloned a couple of feature layers across from AGOL to our Enterprise system which definitely is a win for us. However, when I try to copy a complete Survey it gives me the following error:
Failed to update Form Death Animal Survey - Jordi: 'NoneType' object is not iterable"
It seems to be pointing at the form but I am not sure how to fix this? I have also tried to only clone the form part of the survey to see if that would work but unfortunately not. Thank you very much!
Hi - I used the code exactly as above to copy a dashboard from one AGOL to another, but it only copied the dashboard and not the associated web map and feature layers. The username owns all the items, any thoughts on way it only copied the dashboard?
def deep_copy_content(input_list):for item in input_list:try:print("Cloning " + item.title)copy_list = []copy_list.append(item)gis2.content.clone_items(copy_list, copy_data=True, search_existing_items=True)print("Successfully cloned " + item.title)except Exception as e:print(e)print("The function has completed")deep_copy_content(items)
Cheers
Chris
P.S if I just copy the web map then the associated data does get copied. But when using the dashboard ID just the dashboard copies over.
@HeatherSmith Thank you!
@Juan_Toro-Killion I am told that yes, you can use clone_items() to move content between any two organizational deployments.
Is it possible to use this workflow to copy from ArcGIS Online to Enterprise (Portal)? @HeatherSmith
Thanks,
@HeatherSmith and @cmlosaria_gis
To those of you who were getting the "list out of range" error, how did you resolve it? I have no issues cloning service definitions, file geodatabases and hosted feature layers with only one layer. I get the error anytime I try to clone a hosted feature layer that contains multiple layers and/or tables. These layers and tables are related to one another, if that makes a difference.
Teri
Cloning Plan Compare (latest) ('Failed to create Feature Service Thu Duc City Proposed Land Use Plan: list index out of range', <Item title:"Thu Duc City Proposed Land Use Plan" type:Feature Layer Collection owner:gisencityadmin>) The function has completed
Hi, I am also facing the same problem. I don't use any HTML tags on this application, What could be the problem?
HI guys,
im runnig the script in jupyter and im getting this error in several items, any idea??
('Failed to create Feature Service Departamentos: Your request has timed out.\n(Error Code: 504)', <Item title:"Departamentos" type:Feature Layer Collection owner:NicolasM>)
thanks!!!
Has anyone had the issue "failed to create feature service name of item : 'available', None
I am trying to transfer a web map
Update: I realized the issue was because I was trying to transfer a web map with a feature layer that was hosted on my original account. The account I was trying to transfer to is a public account and they can't host feature layers.
@NikolasHawley that issue is normally related to data not being able to be copied to/from a destination. If you have a `field` with HTML in it or generic text, make sure it's sanitized before the clone operation.
Here is a list of supported HTML tags:
https://doc.arcgis.com/en/arcgis-online/reference/supported-html.htm
Has someone made this into a notebook that can just be shared directly already as opposed to copying from here?
Also, I got this error trying to clone a hosted feature service with related tables... any insight?
Cloning xyz ('Failed to create Feature Service xyz: list index out of range', <Item title:"xyz" type:Feature Layer Collection owner:xyz>) The function has completed
Thank you @BernardRIXEN
The documentation for cloning content is here: https://developers.arcgis.com/python/guide/cloning-content/ which lists the items that are possible to clone. Future changes should be reflected there.There is also now an article which presents a workaround method for copying new StoryMap stories: https://developers.arcgis.com/python/sample-notebooks/clone-storymap-version2/
Hello @HeatherSmith,
great and well explained article. You mentioned "It will not work for ArcGIS StoryMaps or ArcGIS Experience Builder". Where in the Python API or REST API documentation are these limitations listed and updated ?
Regards, Bernard
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registrieren Sie ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.