NetTopologySuite.IO.ShapeFile icon indicating copy to clipboard operation
NetTopologySuite.IO.ShapeFile copied to clipboard

Open a shapefile which contains faulty data

Open airbreather opened this issue 7 years ago • 2 comments

From @laetitiamh on September 7, 2016 14:58

Hi!

I am trying to open a shapefile that contains building outlines using NetTopologySuite.IO.ShapefileReader. I only get around 700 of the 5000+ buildings as a result as the reading stops early because of a faulty linear ring "Number of points must be 0 or >3". This shapefile is automatically generated and contains some errors. I can open the same file in a tool like http://mapshaper.org/ and I can see all the outlines.

The ShapefileEnumerator::MoveNext will return false when it encounters such an exception and as a result the ShapeFileReader::ReadAll will abort the foreach loop. Could we specifiy as an option to the ShapefileReader to continue reading until the end of the file even when it finds faulty geometries?

Thank you very much!

Copied from original issue: NetTopologySuite/NetTopologySuite#121

airbreather avatar Apr 29 '18 02:04 airbreather

From @laetitiamh on October 20, 2016 15:57

Any comment on this issue? Thanks!

airbreather avatar Apr 29 '18 02:04 airbreather

From @axmand on November 1, 2017 4:30

I have the same problem, source code

it will be calling ValidateConstruction while executing instantiation of LinearRing.

var features = soruce.ToFeatureSource().where(p=>p is ILinearRing);

i think this problem can be resolved by adding a property such as "ForceIgnoreValidateConstruction:true".

airbreather avatar Apr 29 '18 02:04 airbreather