Select to view content in your preferred language

Loading data from Feature Layer at the Service to the Feature Layer at Hosted

625
5
Jump to solution
01-12-2024 06:06 AM
Murtaza_Mir
New Contributor III

Hello,

I'm new here and might not be posting in the right place, so apologies if that's the case. My issue involves transferring data between different components in ArcGIS. Specifically, I have a feature layer in a service with some data and geometry, and additional data in an ArcGIS Pro geodatabase. I need to merge these datasets and move them to a hosted feature layer. To achieve this, I've written a Python script. The script's strategy is to first clear the existing data in the hosted feature layer, then import all the data from the service's feature layer and the geodatabase. I've made sure to replicate the schema of the hosted layer, including column names and data types, to match the incoming data. The script runs without errors, and the log file indicates successful operations. However, when I view the hosted feature layer in a browser, the data isn't there. Can someone advise on what I might be doing wrong?

1 Solution

Accepted Solutions
Murtaza_Mir
New Contributor III

I was able to solve the issue. The problem was happening due to the fact that I was merging two data frames together. That was somehow modifying the geometry columns which was preventing the data to get uploaded. So in order to avoid this issue, I did not merge the data frames and uploaded both the data frames separately. That worked.

View solution in original post

0 Kudos
5 Replies
DerekBernard
Occasional Contributor

I would love to know this too.  Transferring data doesn't seem very easy in ArcGIS.  I feel like I'm missing something.

0 Kudos
Murtaza_Mir
New Contributor III

What my approach is that, after truncating the data in the hosted layer, I still load the data as a dataframe. This ensures that I have the exact name of the columns used as well as their data types. Then it is just a matter of mapping the variables that we have in the hosted "dataframe". Also, there are some columns that are there in the hosted but not in service or even the geodatabase. But for those columns, I just add some dummy values. It is important to maintain even such columns to stay consistent with the schema at the hosted. In addition to that, what I am also doing is that maintaining identical "spatial Reference" information of the geometry column. But despite all this, I can't see the data being added at the hosted layer. 

EmilyGeo
Esri Contributor

Depending on your needs, you might be able to use the Update data function to add data to your hosted feature layer. 

This blog by Bekah will walk through what Update Data is and when to use it.

EmilyGeo_1-1705082392114.png

0 Kudos
Murtaza_Mir
New Contributor III

Actually, I am looking for a code-based solution. However, even though I am not getting any errors in my code, I still don't see the data being updated.

0 Kudos
Murtaza_Mir
New Contributor III

I was able to solve the issue. The problem was happening due to the fact that I was merging two data frames together. That was somehow modifying the geometry columns which was preventing the data to get uploaded. So in order to avoid this issue, I did not merge the data frames and uploaded both the data frames separately. That worked.

0 Kudos