GeoJSON File Read Exception Handling in .NET?

137 views Asked by At

Getting this error, somewhere, within a 1gb GeoJSON file.

System.ArgumentOutOfRangeException: 'According to the GeoJSON v1.0 spec a LineString must have at least two or more positions. (Parameter 'coordinates')'

The input file is an open-source US roadway file, made up of LineString. I need to log what is causing the Exception and continue processing. How can that be done? The code looks like this:

var featuresAll = "jsonfiles\\MotorVehicleUseMapRoads.json".CreateFromJsonFile<FeatureCollection>();

...
public static T CreateFromJsonFile<T>(this String fileName)
        {
            T data;
            using (FileStream fileStream = new FileStream(fileName, FileMode.Open))
            {
                data = CreateFromJsonStream<T>(fileStream);
            }
            return data;
        }

Thanks.

0

There are 0 answers