Discussion:
[Jts-topo-suite-user] Polygonizer still crashes with large scale assemble even with improved precisionmodel
Phil Scadden
2016-07-26 02:17:04 UTC
Permalink
The link
https://drive.google.com/file/d/0B3lye8EN1ELEUVphVi1HNkl2VWs/view?usp=sharing
is now working and contains the valid linear rings that I have fed into
the polygonizer.

It crashes as before, stack trace below, but produces the same crash in
TestBuilder.

java.lang.NullPointerException
at
com.vividsolutions.jts.algorithm.RayCrossingCounter.countSegment(RayCrossingCounter.java:134)
at
com.vividsolutions.jts.algorithm.RayCrossingCounter.locatePointInRing(RayCrossingCounter.java:80)
at
com.vividsolutions.jts.algorithm.CGAlgorithms.locatePointInRing(CGAlgorithms.java:167)
at
com.vividsolutions.jts.algorithm.CGAlgorithms.isPointInRing(CGAlgorithms.java:148)
at
com.vividsolutions.jts.operation.polygonize.EdgeRing.findEdgeRingContaining(EdgeRing.java:85)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.assignHoleToShell(Polygonizer.java:242)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.assignHolesToShells(Polygonizer.java:236)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.polygonize(Polygonizer.java:198)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.getPolygons(Polygonizer.java:143)
at nz.cri.gns.tsurfist.tsurface.assembleEdges(tsurface.java:1316)
at nz.cri.gns.tsurfist.tsurface.loadFromFile(tsurface.java:1450)
at nz.cri.gns.tsurfist.ProcessCmdLine.main(ProcessCmdLine.java:48)
at
nz.cri.gns.tsurfist.ProcessCmdLineTest.testMain(ProcessCmdLineTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
--
Phil Scadden, GNS Science Ltd 764 Cumberland St, Private Bag 1930,
Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
Michaël Michaud
2016-07-26 06:21:42 UTC
Permalink
Hi Phil,

I don't know exactly what is the cause of the problem but I may have
found a way to solve it.

Some segments of the dataset appears twice, but the polygonizer needs a
clean, noded linework as input.

To clean it, I used OpenJUMP

- Tools > Edit Geometry > Convert > Extract Segments (option="Make
double segments unique")

- Tools > Edit Geometry > Convert > Polygonize

It will need more time to investigate why the error occurs though as the
algorithm should not produce a NullPointerException in any case.

Regards,

Michaël
Post by Phil Scadden
The link
https://drive.google.com/file/d/0B3lye8EN1ELEUVphVi1HNkl2VWs/view?usp=sharing
is now working and contains the valid linear rings that I have fed into
the polygonizer.
It crashes as before, stack trace below, but produces the same crash in
TestBuilder.
java.lang.NullPointerException
at
com.vividsolutions.jts.algorithm.RayCrossingCounter.countSegment(RayCrossingCounter.java:134)
at
com.vividsolutions.jts.algorithm.RayCrossingCounter.locatePointInRing(RayCrossingCounter.java:80)
at
com.vividsolutions.jts.algorithm.CGAlgorithms.locatePointInRing(CGAlgorithms.java:167)
at
com.vividsolutions.jts.algorithm.CGAlgorithms.isPointInRing(CGAlgorithms.java:148)
at
com.vividsolutions.jts.operation.polygonize.EdgeRing.findEdgeRingContaining(EdgeRing.java:85)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.assignHoleToShell(Polygonizer.java:242)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.assignHolesToShells(Polygonizer.java:236)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.polygonize(Polygonizer.java:198)
at
com.vividsolutions.jts.operation.polygonize.Polygonizer.getPolygons(Polygonizer.java:143)
at nz.cri.gns.tsurfist.tsurface.assembleEdges(tsurface.java:1316)
at nz.cri.gns.tsurfist.tsurface.loadFromFile(tsurface.java:1450)
at nz.cri.gns.tsurfist.ProcessCmdLine.main(ProcessCmdLine.java:48)
at
nz.cri.gns.tsurfist.ProcessCmdLineTest.testMain(ProcessCmdLineTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Loading...