GeoJSON Hosted Layer Error

1705
11
01-13-2020 09:23 AM
TaylorKravits
New Contributor II

I'm attempting to publish a geojson file as a hosted layer to ArcGIS Online but it gives me "There was an error". However, if I add it as a layer to an already created map, it shows just fine.

I have the permissions of a creator and publisher under my organization.

The type is a Feature Collection, crs is set, I'm not really sure what else it could be.

Has anyone had this error before?

0 Kudos
11 Replies
TaylorKravits
New Contributor II

To give an update, I was able to create another geojson layer and automate the upload process no problem, so there's something wrong with my geojson data in this specific instance. If I can figure out why, I'll post a solution. 

0 Kudos
PeterYoung2
New Contributor

I had a similar issue trying to publish a hosted feature layer from a GeoJSON file. Kept getting the mostly unhelpful "There was an error" message on some files but not others. After hours of troubleshooting I found the error in my case. My GeoJSON data has several features. One of the fields (GeoJSON "properties") has values that can be a combination of numbers and letters, so it needs to be a Text field. It appears when you publish a hosted feature layer from GeoJSON, ArcGIS Online infers the field types based on the first feature. In cases where my GeoJSON's first feature had a value that was all numbers, ArcGIS Online sets that field type to Integer. Then when it gets to a feature that has letters in that field, it can't put a string in an Integer field and...mostly unhelpful error message.

My workaround was to rewrite my GeoJSON file and stick a "_s" at the end of the value for that field in the first feature. Not ideal to mess up the data, but in my case that field is relatively unimportant, so I can live with it.