引起:java.lang.IllegalStateException:无法定位多边形的内部点

时间:2016-08-29 12:06:29

标签: java geotiff

使用Geo Tiff渲染图像时出现错误

//vectorization
System.out.println("vectorization starts");
GridCoverage2D srcCoverage = new GeoTiffReader(new File("E:/output/sometiffile.TIFF")).read(new GeneralParameterValue[]{policy, gridsize, useJaiRead});
SimpleFeatureCollection fc = RasterToVectorProcess.process(srcCoverage, 0, cov.getEnvelope(), Collections.singletonList(0.0d), true, null);
System.out.println("process ends");
MapContext map = new DefaultMapContext();
map.setTitle("raster to vector conversion");
Style style = SLD.createPolygonStyle(Color.BLUE, Color.CYAN, 1.0f);
map.addLayer(fc, style);
JMapFrame.showMap(map);
System.out.println("vectorization ends");

输出

vectorization starts
adding...
adding...
adding...
adding...
adding...
adding...
adding...
Exception in thread "main" org.geotools.process.ProcessException: java.lang.IllegalStateException: Can't locate interior point for polygon
    at org.geotools.process.raster.RasterToVectorProcess.convert(RasterToVectorProcess.java:385)
    at org.geotools.process.raster.RasterToVectorProcess.process(RasterToVectorProcess.java:310)
    at com.rgb.PixelExtractor.extract(PixelExtractor.java:347)
    at com.rgb.RGBSpliter.main(RGBSpliter.java:92)
Caused by: java.lang.IllegalStateException: Can't locate interior point for polygon
    at org.geotools.process.raster.RasterToVectorProcess.assembleFeatures(RasterToVectorProcess.java:452)
    at org.geotools.process.raster.RasterToVectorProcess.convert(RasterToVectorProcess.java:380)
    ... 3 more

1 个答案:

答案 0 :(得分:0)

我忘了添加乐队

 SimpleFeatureCollection fc = RasterToVectorProcess.process(srcCoverage, 3, cov.getEnvelope(), Collections.singletonList(0.0d), true, null);