Select to view content in your preferred language

ArcGIS Online - unwanted field type change (int to string) when updating an existing feature layer

1093
3
Jump to solution
11-22-2023 01:08 PM
Labels (1)
StijnSchoutenTheGISLord
Occasional Contributor

Hello everyone,

Thank you for reading my question! I'm trying to update an existing feature layer with a file. However a field is changed during the update proces from a string to an int and changed the value without my intent.

I'll try to list my steps as thorough as possible

Download the zip file with two JSON files. The initial.json contains a FeatureCollection with a single feature containing a single property. 

After that I upload the file to ArcGIS Online and create a hosted feature layer

StijnSchoutenTheGISLord_0-1700686366059.png

This will work without any problems!

The second file insert_w_extra_column.json contains also a FeatureCollection with a different feature and also an extra property called BAG_ID. This property is formatted as a string and must remain a string. Before I upload the second json I add an extra column like this:

StijnSchoutenTheGISLord_1-1700686583896.png

After adding the column I confirm that the column has been added and is empty because the first feature didn't contain the initial column. 

StijnSchoutenTheGISLord_2-1700686670355.png

Ok now for the final part. I update the existing feature layer with the second json

StijnSchoutenTheGISLord_3-1700686719828.png

I select the first option "Add Features" and the let ArcGIS Online automatically match the columns for me.

Following the update action I get the green confirmation at the bottom of my screen.

StijnSchoutenTheGISLord_4-1700686839814.png

Above you can see the final result of the update operation.

Some facts:

  • The original json was formatted like this:

 

{
  "type": "FeatureCollection",
  "features": [
    {
      "geometry": {
        "coordinates": [
          3.6025124,
          51.4391151
        ],
        "type": "Point"
      },
      "properties": {
        "VOLTAGE": "200Kv",
        "BAG_ID": "0518100000338500"
      },
      "type": "Feature"
    }
  ]
}

 

  • In the JSON the BAG_ID is clearly a string
  • The ArcGIS Online column is also still of type string
  • The final number in ArcGIS Online is displayed as a scientific number
  • If I download the layer as GeoJSON the output is formatted like this

 

            "properties": {
                "VOLTAGE": "200Kv",
                "ObjectId": 2,
                "BAG_ID": "5.181E+14"
            }​

 

Why is this the case, this doesn't seem intended? It is kinda important for us as the ID gets lost in this way.

Any help or members willing to trying to replicate is greatly appreciated! 

0 Kudos
1 Solution

Accepted Solutions
timcneil
Esri Contributor

Hi StijnSchoutenTheGISLord, 

Sorry to hear you're experiencing this issue. I was able to reproduce it with the attached zip file as well.  

I would encourage you to open up a ticket with Esri support. This seems like a bug since the value is being incorrectly displayed in scientific notation after updating the data, particularly since the data is initially being published with the value that you would expect (0518100000338500). 

In the meantime, if it's possible for your workflow I would suggest using a different file type for your Update Data operation. If I take the data from your JSON file and publish/update with an XLSX file instead (attached below), the data will insert as expected with no conversion to scientific notation. 

timcneil_1-1701443331116.png

 

Best, 

Taylor 

View solution in original post

3 Replies
StijnSchoutenTheGISLord
Occasional Contributor

Ok I just made an easier test case with the same output. Uploading the second json (with the extra column) twice. First as the definition layer and then as the update. See my screen recording here:

 

0 Kudos
timcneil
Esri Contributor

Hi StijnSchoutenTheGISLord, 

Sorry to hear you're experiencing this issue. I was able to reproduce it with the attached zip file as well.  

I would encourage you to open up a ticket with Esri support. This seems like a bug since the value is being incorrectly displayed in scientific notation after updating the data, particularly since the data is initially being published with the value that you would expect (0518100000338500). 

In the meantime, if it's possible for your workflow I would suggest using a different file type for your Update Data operation. If I take the data from your JSON file and publish/update with an XLSX file instead (attached below), the data will insert as expected with no conversion to scientific notation. 

timcneil_1-1701443331116.png

 

Best, 

Taylor 

StijnSchoutenTheGISLord
Occasional Contributor

Hi Taylor,

Thank you for replying and confirming this bug with your reproduction! We've found another work-around as well. I'll share it here for other readers:

  1. Upload the GeoJSON to ArcGIS Online (API: gis.content.add)
  2. Publish the uploaded GeoJSON (API: <item>.publish)
  3. Export the published GeoJSON as FeatureCollection (<item>.export("title", export_format="Feature Collection", wait=True)
  4. Use the FeatureCollection item in the Upsert statement: 
    append_result = <layer>.append(
    item_id=<FeatureCollectionId>,
    upload_format="featureCollection")

I've also submitted an official bug report. For now i'll just close this topic

0 Kudos