Comments (5)
Hi Kuba,
I have tried the last version of the library and now with the options
var options = new ShapefileReaderOptions()
{
GeometryBuilderMode = GeometryBuilderMode.FixInvalidShapes
};
var currentFeatures = Shapefile.ReadAllFeatures(shpStream, dbfStream, options);
//we added the methods that use streams from the start
We can read both a6a6 and 3509 zips!
Thank you so very much!!!
Bye
Francesca
from nettopologysuite.io.esri.
Hi kubaszostak,
i have not found a solution yet but what i have noticed is that it is probably a question of decimal digits...
Because Multypoligon tmpA6A6 crashes
While Multypoligon tmp3509 works
points in tmpA6A6 where it crashes
11.9797646969949998
44.88052525112210134
11.97958996594410053
44.88039510494419915
11.97940691328200025
44.88051933463930254
11.97958164432600014
44.88064948109619934
11.9797646969949998
44.88052525112210134
points in tmp3509 where it works
11.98410995573788007
44.87705361570291984
11.98413715530627499
44.87705443978246223
11.98412541839736356
44.87681169189863084
11.98409970871640873
44.87681083371183632
11.98410995573788007
44.87705361570291984
[tmpA6A6
tmp3509.zip
.zip](https://github.com/NetTopologySuite/NetTopologySuite.IO.Esri/files/10093291/tmpA6A6.zip)
from nettopologysuite.io.esri.
Hi Francesca,
I've updated the code and now you can read your shapefiles:
var options = new ShapefileReaderOptions()
{
GeometryBuilderMode = GeometryBuilderMode.IgnoreInvalidShapes
};
var shpPath = TestShapefiles.PathTo("Issues/009/tmpA6A6/Rx/PPPP29_0.shp");
var features = Shapefile.ReadAllFeatures(shpPath, options);
Assert.AreEqual(50, features.Count());
Console.WriteLine("Invalid shape geometries:");
foreach (var feature in features)
{
if (!feature.Geometry.IsValid)
{
Console.WriteLine(string.Join(", ", feature.Attributes.GetValues()));
}
}
You can also fix invalid geometries by using GeometryBuilderMode.FixInvalidShapes
option. It will work for tmpA6A6
file, but not for tmp3509
. The latter contains self-intersecting polygon shells, so it can't be fixed automatically.
from nettopologysuite.io.esri.
This also fixes Cannot read a polygon with a hole from a ShapeFile #70 issue.
from nettopologysuite.io.esri.
Hi Kuba,
thank you very much, I will try today.
I have a question.
I noticed that taking the file that didn't work (A6A6) and saving it with QGIS with UTF-8 encoding was then read correctly by the library.
Is it mandatory to use UTF-8 encoding or is it irrelevant?
Thank you
bye
Francesca
from nettopologysuite.io.esri.
Related Issues (20)
- Export shape file with (spatial reference) WKT HOT 5
- Editing attribute data of an existing shapefile, using VB.NET HOT 2
- Ensure ShapefileReader does not use Geometry.Empty member
- Reprojection HOT 1
- How do I get the Feature Id? HOT 2
- How to write Shapefile header HOT 4
- Invalid Polygon Issue HOT 3
- Multi-polygon bringing in extra/redundant polygons? HOT 6
- Reading in invalid dates HOT 1
- Merge https://github.com/FObermaier/SharpSbn HOT 1
- PointZ shapefiles are not properly read HOT 2
- Is there a way to get shapefile field aliases? HOT 2
- Null value HOT 9
- Invalid geometry type provided (Polygon). Expected: Multilinestring HOT 1
- Problem with saving attributes readed from existing file HOT 1
- Cannot Write Shapefile with LineStrings using ShapefileWriter HOT 2
- nuget out of date HOT 5
- Saving geometries with Z=NaN HOT 3
- GDBWriter and GDBReader classes removed? HOT 6
- Allow DbfCharacterField support 255 length. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nettopologysuite.io.esri.