Cannot create JSONToFeatures output in memory

369
4
Jump to solution
02-25-2022 02:56 PM
EricEagle
Occasional Contributor III

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?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

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


... sort of retired...

View solution in original post

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

It could be that only current and scratch workspace are supported environments


... sort of retired...
0 Kudos
Luke_Pinner
MVP Regular Contributor

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.

0 Kudos
DanPatterson
MVP Esteemed Contributor

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


... sort of retired...
0 Kudos
EricEagle
Occasional Contributor III

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)!

0 Kudos