Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1009: WKTWriter#writeMultiLineString produces invalid WKT string #1010

Merged
merged 3 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,22 @@ public void test_MultiPolygon()
writer.toString() );

}

@Test
public void test_MultiLineString()
throws XMLParsingException, XMLStreamException, FactoryConfigurationError, IOException,
UnknownCRSException {

Set<WKTFlag> flag = new HashSet<WKTFlag>();
Writer writer = new StringWriter();
WKTWriter WKTwriter = new WKTWriter( flag, decimalFormatter );
Geometry geom = parseGeometry( "MultiLineString.gml" );
WKTwriter.writeGeometry( geom, writer );
// System.out.print( writer.toString() + "\n" );
assertEquals( "MULTILINESTRING ((7.1 50.7,10.0 53.5,13.4 52.5),(7.1 50.7,10.0 53.5,13.4 52.5))", writer.toString() );

}


// ############################## PARSING THE GEOMETRY-FILE
private Geometry parseGeometry( String fileName )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1191,11 +1191,10 @@ public void writeMultiLineString( MultiLineString geometry, Writer writer )
for ( int i = 0; i < geometry.size(); i++ ) {
writer.append( '(' );
writeLineStringWithoutPrefix( geometry.get( i ), writer );
writer.append( ')' );
if ( i < geometry.size() - 1 ) {
writer.append( ',' );

writer.append( ',' );
}
writer.append( ')' );
}

writer.append( ')' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public void simplifyMultiCurve() {
MultiCurve<?> multiCurve = fac.createMultiCurve( null, CRSUtils.EPSG_4326, memberCurves );
MultiLineString simplified = (MultiLineString) simplifier.simplify( multiCurve );
assertEquals(
"MULTILINESTRING ((0.000000 0.000000,1.000000 1.000000,5.000000 5.000000,10.000000 10.000000,)(0.000000 0.000000,1.000000 1.000000,5.000000 5.000000,10.000000 10.000000,12.317848 12.699677,14.612186 15.419362,16.882842 18.158850,19.129644 20.917935,21.352424 23.696410,23.551014 26.494065,25.725249 29.310690,27.874965 32.146073,30.000000 35.000000))",
"MULTILINESTRING ((0.000000 0.000000,1.000000 1.000000,5.000000 5.000000,10.000000 10.000000),(0.000000 0.000000,1.000000 1.000000,5.000000 5.000000,10.000000 10.000000,12.317848 12.699677,14.612186 15.419362,16.882842 18.158850,19.129644 20.917935,21.352424 23.696410,23.551014 26.494065,25.725249 29.310690,27.874965 32.146073,30.000000 35.000000))",
simplified.toString() );
}

Expand Down