Hello,

During a real case attempt, while reading a shapefile containing outlining of 
cities coming from 
https://www.data.gouv.fr/fr/datasets/geofla-communes/
(the guadeloupean set of files)
I encountered three multiparts polygons inside, a thing that we weren’t able to 
handle yet and that stopped the reading of the shapefile by an 
InvalidShapefileFormatException.

I attempted to add the ability to handle multipart polygons in this Java source 
:
storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java

but I’ve kept most of the original code unchanged (marked as @Deprecated) in 
case of trouble.

ESRI Specification pdf 
https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf

explain how multiparts polygons are stored (pages 8 to 10) and I need your 
advice : 
Example shown on page 10 describe a case where the second part of the polygon 
is linked to the first one (and that make a bigger polygon of two parts linked 
by v1). This case the code I have changed should handle it.

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 ?)


Regards,

Marc Le Bihan

P.S. : I cannot run all the tests, and have to run them separately due to this 
problem below. What should I do ?

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? Test class                                          ? Test method             
                ? Target logger         ? Level         ?
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? org.apache.sis.io.wkt.WKTParserTest                 ? testGeocentric          
                ? org.apache.sis.io.wkt ? AVERTISSEMENT ?
? org.apache.sis.io.wkt.WKTParserTest                 ? 
testProjectedWithImplicitParameterUnits ? org.apache.sis.io.wkt ? AVERTISSEMENT 
?
? org.apache.sis.io.wkt.WKTParserTest                 ? testEngineeringRotated  
                ? org.apache.sis.io.wkt ? AVERTISSEMENT ?
? org.apache.sis.test.integration.DefaultMetadataTest ? testUnmarshalling       
                ? org.apache.sis.xml    ? AVERTISSEMENT ?
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Tests run: 831, Failures: 1, Errors: 0, Skipped: 9, Time elapsed: 7.941 sec <<< 
FAILURE! - in org.apache.sis.test.suite.ReferencingTestSuite
testNormalizedWKT(org.apache.sis.referencing.operation.projection.LambertConicConformalTest)
  Time elapsed: 0.005 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

Reply via email to