I need to automate uploading a ~35,000 record json file to portal. The method I'm using shows the points and record count on the portal, but the attribute table is empty. I'm using the
fl.edit_features(adds="")
method. I started trying to chunk the json into smaller parts b/c I thought that would be useful, but it's the same result, an empty table. In the code below I'm using a chunk size of 100 and limiting to 500 rows for quicker testing. Does anyone know what I can try to get the table to display its data?
localJSON = "E:/batch/AddressRematch/data.json"
with open(localJSON, "r") as jsonfile:
all_data = jsonfile.read()
# load json data to a dict
entire_featureset_dict = json.loads(all_data)
# convert to a list
features_list = entire_featureset_dict["features"]
base_featureset_dict = entire_featureset_dict.copy()
# create a chunk
start = 0
chunk_size = 100
end = start + chunk_size
#breakpoint()
while start < 500: #len(features_list):
# grab a chunk
# copy a slice of the feature set
base_featureset_dict["features"] = features_list[start:end]
chunk_fs = arcgis.features.FeatureSet.from_dict(base_featureset_dict)
#print(chunk_fs)
# upload it to the layer
fl.edit_features(adds=chunk_fs)
#print(arcpy.GetMessages(0))
start += chunk_size
end += chunk_size