Hi, I need to create a memory featureclass from a JSON file (Esri).
My code looks like this:
json_out = f"C:/Temp/feats_{datetime.strftime(now, '%Y-%m-%dT%H%M%S')}.json"
with open(json_out, 'w') as outfile:
outfile.write(str(feature_set)) # feature_set is validated Esri JSON
# The JSON file loads fine and the conversion works
# without issue in the ArcGIS Pro GUI when writing to a file geodatabase.
new_fc = arcpy.JSONToFeatures_conversion(json_out, r"memory\temp_fc")
This yields
arcgisscripting.ExecuteError: ERROR 000206: Cannot create FeatureClass 'memory\temp_fc'.
I've tried giving it a geometry_type (unnecessary, it's EsriJSON) with no change.
Ideas?
Solved! Go to Solution.
in_memory is the legacy memory-based workspace built for ArcMap that supports output feature classes, tables, and raster datasets.
perhaps that was around the time of transition to the new memory workspace. apparently it is still around and supported within Pro, might be worth a shot
It could be that only current and scratch workspace are supported environments
I had a python toolbox that used the memory workspace for arcpy.JSONToFeatures_conversion. It worked fine in Pro 2.3 but stopped working when we moved to 2.6. I haven't tried in 2.8.
in_memory is the legacy memory-based workspace built for ArcMap that supports output feature classes, tables, and raster datasets.
perhaps that was around the time of transition to the new memory workspace. apparently it is still around and supported within Pro, might be worth a shot
Thanks Dan, I switched to in_memory and it worked. Hopefully that won't be deprecated any time soon (or at least not before memory supports all the same operations)!