bilaldursun1 / nettopologysuite

Automatically exported from code.google.com/p/nettopologysuite
0 stars 0 forks source link

DouglasPeuckerLineSimplifier.Simplify causes OutOfRangeException #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
I have tried to use the DouglasPeuckerLineSimplifier on LineStrings and
LinearRings without any success.
All my calls to DouglasPeuckerLineSimplifier.Simplify lead to an
OutOfRangeException in DouglasPeuckerLineSimplifier.getUseCoordinate

FYI, I am currently using v2.11 rev 501 under VS2008 + Win7 x64
You will find a simple reproducer in attachment.

My original intention was to use the TopologyPreservingSimplifier but 
I suspect that it is still under development (i.e. file is not included in
the project for building).

Best regards,
Michel.

Original issue reported on code.google.com by michel.f...@gmail.com on 13 Apr 2010 at 11:39

Attachments:

GoogleCodeExporter commented 9 years ago
I've added the 2.11 maintainers in CC

Original comment by diegogu...@gmail.com on 13 Apr 2010 at 1:07

GoogleCodeExporter commented 9 years ago
DouglasPeuckerLineSimplifier:
- List<BitVector32> not correctly initialized
- Bug in setUseCoordinate(...) and getUseCoordinate(...)
Fixed as of Rev 502

Original comment by felix.ob...@netcologne.de on 13 Apr 2010 at 2:50

GoogleCodeExporter commented 9 years ago
Thumbs up! Thanks a lot for the quick fix.
Michel.

Original comment by michel.f...@gmail.com on 13 Apr 2010 at 3:27

GoogleCodeExporter commented 9 years ago
You may want to try TopologyPreservingSimplifier, which I just fixed and added 
to the
solution (Rev. 503)

Original comment by felix.ob...@netcologne.de on 13 Apr 2010 at 10:32

GoogleCodeExporter commented 9 years ago
I gave a try to TopologyPreservingSimplifier using the static Simplify method:
Ex:
IGeometry<Coordinate> inputGeometry = lineString as IGeometry<Coordinate>;
IGeometry<Coordinate> outputGeometry =
TopologyPreservingSimplifier<Coordinate>.Simplify(inputGeometry, tolerance);

where LineString is the original input geometry declared as ILineString. 
Its value could be:
LINESTRING (-5000 -5000, -5000 5000, 5000 5000, 5000 -5000, -5000 -5000)

The call causes a NullReferenceException in TaggedLinesSimplifier.Simplify line 
41.
It seems to be due to the fact that in this scenario
TopologyPreservingSimplifier<TCoordinate>.GeometryFactory is null.

Hope it will help.

Original comment by michel.f...@gmail.com on 14 Apr 2010 at 8:26

GoogleCodeExporter commented 9 years ago
You need to set TopologyPreservingSimplifier<Coordinate>.GeometryFactory to your
GeometryFactory prior to using TopologyPerservingSimplifier. See the relating 
NUnit
test case for an example.

Original comment by felix.ob...@netcologne.de on 14 Apr 2010 at 8:35

GoogleCodeExporter commented 9 years ago
Sorry, I didn't look at the test. It works perfectly now.
Thanks again for your support.

Original comment by michel.f...@gmail.com on 14 Apr 2010 at 8:55