Some GeoJSON files fail to be imported by JSONToFeatures

509
0
09-22-2023 06:30 AM
sbayarri_gilytics
Emerging Contributor

 

Hi there,

I'm using ArcGIS Pro 3.0 and trying to import some geoJSON files generated somewhere else.

Some of the files (e.g. od39685.geojson, attached as .zip) import fine, while others fail to create a FeatureClass (see od39781.geojson attached as .zip).

Both types of files are generated by the same external process and we have been unable to see any significant difference.

The geoprocess doesn't return an error, but when we check if the FC exists, it's not found in the GDB.

Could it be just a matter of size of the file, or size of the features?

The importing code is:

 

                        string featureClassPath = Path.Combine(ArcGIS.Desktop.Core.Project.Current.DefaultGeodatabasePath,
                            validMapLayerName);
                        // convert geojson
                        var parameters = Geoprocessing.MakeValueArray(geoJSONfilename, featureClassPath, esriGeomType);
                        var gpResult = await Geoprocessing.ExecuteToolAsync("conversion.JSONToFeatures", parameters,
                                            null, CancelableProgressor.None, GPExecuteToolFlags.None);
                        // Apparently, tbe geoprocess returns no error, so we continue...

                        // Check if the FeatureClass has been really created
                        try
                        {
                            string projGDBPath = ArcGIS.Desktop.Core.Project.Current.DefaultGeodatabasePath;
                            Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(projGDBPath)));

                            FeatureClassDefinition featureClassDefinition =
                                geodatabase.GetDefinition <FeatureClassDefinition>(validMapLayerName);
                            featureClassDefinition.Dispose();
                        }
                        catch
                        {
                            // WE DETECT THE FAILURE HERE: the FC does not exist
                            return;
                        }

 

 

0 Kudos
0 Replies