2

I have a folder on my local drive with 1,500+ JSON files (lines) that I need converted to shapefiles. (JSON to feature tool in ArcGIS works great on a single JSON file)

I've tried getting a batch model in Python to work, but this code seems to give me an ERROR 000206 after 31 JSON files...

Any ideas?

(I'm using ArcGIS 10.2 and PyScripter)

import arcpy
import os

dirOfJSON = 'c:/temp/jsons'
outputDIrectory = 'c:/temp/jsonSHPs'

arcpy.env.workspace = dirOfJSON

for f in arcpy.ListFiles('*.json'):
    j = os.path.join(dirOfJSON, f)
    outputShp = os.path.join(outputDIrectory, os.path.splitext(f)[0] + '.shp')
    print("Processing : {}".format(outputShp))
    arcpy.JSONToFeatures_conversion(j, outputShp)
2
  • There seems no error in code, it is working properly in my system. There must be some error in naming convention of folder or json files. Commented Feb 23, 2017 at 7:12
  • I tested your code and it worked for me also, however I'm not processing over 1,500 .json files. Is the 32nd .json file name incorrectly? Did your .gdb reach a storage limit?
    – Natalie H.
    Commented Apr 6, 2017 at 18:23

1 Answer 1

4

Based on that error code it looks like you're trying to create a feature class and giving it a name with illegal characters.

000206 : Cannot create FeatureClass <value>.

The named feature class cannot be created as named.

Solution

The name that has been specified is likely invalid. Correct the name and try again. All data formats have characters that are considered invalid and should not be used as feature class names. Rename the feature class using characters that are valid for the underlying database. In addition to spaces, the following list contains characters that should not be used in a geodatabase feature class name: `~@#$%^&*()-+|\,<>?{}.!'[]:;. If working in Python, ArcPy has functions that allow you to validate table names and field names. You can use the ValidateTableName or ValidateFieldName functions to ensure that the name is valid.

1
  • Jeff, this is not the case. My files are named PL123 PL456 PL789. I am not using any characters besides letter and numbers.
    – Daniel
    Commented Nov 21, 2016 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.