Hi all,

 

I ran into a problem that has shown up here before:

 

http://www.nabble.com/Shapefiles---Line-td2684782.html

 

You get a java.lang.ClassCastException if you try to write Shapefiles with
LineStrings by using the ShapefileWriter.

Thats because the getLength() Method of the MultiLineHandler is called by
the writeHeaders() Method (the private one) 

of the ShapefileWriter which supplies every single LineString in his
GeometryCollection(MultiLineString in this case) container.

 

The getLength() Method of MultiLineHandler does a cast like this:

 

MultiLineString multi = (MultiLineString) geometry. 

 

This can't work because LineStrings are supplied in this scenario.

 

 

The PolygonHandler by the way checks the supplied geometry like this:

 

if (geometry instanceof MultiPolygon) {

      multi = (MultiPolygon) geometry;

} else {

      multi = geometryFactory.createMultiPolygon(new Polygon[] { (Polygon)
geometry });

}

 

If the MultiLineHandler would do this too there would be no problem.

 

Greetings,

 

Sebastian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to