I've made a change to call Polygon.startPath() each time a new part begins.
I saw two cities among the three in the shapefile that have multiparts
polygons : Point à pitre and Morne à l'eau.
They both have distincts polygons under the same name : the main city and a
small island near the shore, for example. They are not dirty polygons.
-----Message d'origine-----
From: Marc Le Bihan
Sent: Sunday, November 08, 2015 8:14 PM
To: [email protected]
Subject: Re: Attempt to load polygons that have multiple parts from a
shapefile.
The unit test is still failing, sorry.
Tests run: 831, Failures: 1, Errors: 0, Skipped: 9, Time elapsed: 8.037 sec
<<< FAILURE! - in org.apache.sis.test.suite.ReferencingTestSuite
testNormalizedWKT(org.apache.sis.referencing.operation.projection.LambertConicConformalTest)
Time elapsed: 0.004 sec <<< FAILURE!
java.lang.AssertionError: WKT does not match the expected regular
expression. The WKT that we got is:
PARAM_MT[ôLambert conic conformalö,
PARAMETER[ôexcentricityö, 0.0818191908426215],
PARAMETER[ônö, 0.6427876096865393]]
at org.junit.Assert.fail(Assert.java:88)
at
org.apache.sis.test.MetadataAssert.assertWktEqualsRegex(MetadataAssert.java:132)
at
org.apache.sis.referencing.operation.transform.MathTransformTestCase.assertWktEqualsRegex(MathTransformTestCase.java:379)
at
org.apache.sis.referencing.operation.projection.LambertConicConformalTest.testNormalizedWKT(LambertConicConformalTest.java:106)
Results :
Failed tests:
LambertConicConformalTest.testNormalizedWKT:106->MathTransformTestCase.assertWktEqualsRegex:379
WKT does not match the expected regular expression. The WKT that we got is:
PARAM_MT[?Lambert conic conformal?,
PARAMETER[?excentricity?, 0.0818191908426215],
PARAMETER[?n?, 0.6427876096865393]]
Tests run: 831, Failures: 1, Errors: 0, Skipped: 9
-----Message d'origine-----
From: Martin Desruisseaux
Sent: Sunday, November 08, 2015 2:01 PM
To: [email protected]
Subject: Re: Attempt to load polygons that have multiple parts from a
shapefile.
Hello Marc
Le 08/11/15 10:40, Marc Le Bihan a écrit :
But page 8 shows a figure with two distincts polygon. An event that should
force us to return two polygons for a feature instead of one. This case is
called a dirty polygon by the specification, and I don’t detect it yet.
When I will try to detect this problem and react to it, I will have two
choices :
- Leave it alone : the polygon created will have an additional line
linking the two parts that his creator expected distincts.
- Reject the bad polygon : return a polygon with only its first part, and
of course put a warning in the logs file. (the best thing to do ?)
I think we should avoid approach 1 (two polygons connected by a line
that was not in the data), since it could cause issues not only at
rendering time, but also when interpreting the data.
If we have no other choice, approach 2 could be done. But some libraries
have the concept of MultiPolygon which we could have used. I see no
explicit MultiPoylgon class in ESRI Geometry API, but I noticed that
com.esri.core.geometry.Polygon has the concept of multi-path, where new
paths can apparently be started by calls to the
Polygon.startPath(double, double) method. Has this approach been explored?
P.S. : I cannot run all the tests, and have to run them separately due to
this problem below. What should I do ?
Failed tests:
LambertConicConformalTest.testNormalizedWKT:106->MathTransformTestCase.assertWktEqualsRegex:379
WKT does not match the expected regular expression. The WKT that we got
is:
PARAM_MT["Lambert conic conformal",
PARAMETER["excentricity", 0.0818191908426215],
PARAMETER["n", 0.6427876096865393]]
Thanks for the report. I presume that this is a end-of-line style issue
(Windows versus Unix). I just enabled the Pattern.MULTLINE option in the
regex used in the test method. Could you confirm me if it works?
Martin