Anaxa Gore wrote:
>
> Hi,
>
> I am writing some geotiff and would like then open them using GT !
> My writing operation is thi s:
>
> GridCoverageFactory gcf = new GridCoverageFactory();
> Color[][] colors = new Color[][] {{Color.WHITE, color}};
> GridCoverage2D gc = gcf.create("Horizon Coverage", rasterCoverage,
> this.rasterEnvelope,null,null,null,colors,null);
>
> // The Format used to write a geotiff file.
> final GeoTiffFormat format = new GeoTiffFormat();
> // The parameters used to write a geotiff file.
> final GeoTiffWriteParams wp = new GeoTiffWriteParams();
>
> // No compression -> never mind the size of pictures, we must go fast
> wp.setCompressionMode(GeoTiffWriteParams.MODE_DISABLED);
> // We keep the tile size
> wp.setTilingMode(GeoToolsWriteParams.MODE_DEFAULT);
>
> final ParameterValueGroup paramWrite = format.getWriteParameters();
> paramWrite.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);
>
> File outFile = new
> File(getCoveragesFolder(true).getPath()+File.separator+"coverage.TIF");
> GeoTiffWriter gtw = (GeoTiffWriter)format.getWriter(outFile);
> gtw.write(gc,(GeneralParameterValue[])paramWrite.values().toArray(new
> GeneralParameterValue[1]));
>
>
> When I have done this, I want to read this geotiff newly created, like
> this
> :
>
> Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER,
> Boolean.TRUE);
> GeoTiffReader reader = new GeoTiffReader(outFile, hints);
> MapLayer coveragelayer = new DefaultMapLayer(reader.read(null),
> getCoverageLayerStyle());
> coveragelayer.setTitle("_");
>
> context.addLayer(coveragelayer);
>
> But then , I got this message :
>
> org.opengis.referencing.operation.OperationNotFoundException: Les
> paramètres
> de Bursa Wolf sont requis.
> at
> org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:1070)
> at
> org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:1134)
> at
> org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:879)
> at
> org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:237)
> at
> org.geotools.referencing.operation.BufferedCoordinateOperationFactory.createOperation(BufferedCoordinateOperationFactory.java:253)
> at org.geotools.referencing.CRS.findMathTransform(CRS.java:947)
> at org.geotools.referencing.CRS.findMathTransform(CRS.java:915)
> at
> org.geotools.coverage.grid.io.AbstractGridCoverage2DReader.getResolution(AbstractGridCoverage2DReader.java:673)
> Caused: org.geotools.data.DataSourceException: Unable to get resolution
> at
> org.geotools.coverage.grid.io.AbstractGridCoverage2DReader.getResolution(AbstractGridCoverage2DReader.java:688)
> at
> org.geotools.coverage.grid.io.AbstractGridCoverage2DReader.setReadParams(AbstractGridCoverage2DReader.java:255)
> at org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:389)
> at
> org.geotools.renderer.lite.StreamingRenderer.renderRaster(StreamingRenderer.java:1845)
> at
> org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:1710)
> at
> org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1656)
> at
> org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1600)
> at
> org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:644)
> at
> org.geotools.renderer.shape.ShapefileRenderer.renderWithStreamingRenderer(ShapefileRenderer.java:1456)
> at
> org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1325)
> at
> org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:266)
> at
> org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1481)
> at
> org.geotools.gui.swing.map.map2d.strategy.SingleBufferedImageStrategy.createBufferImage(SingleBufferedImageStrategy.java:132)
> [catch] at
> org.geotools.gui.swing.map.map2d.strategy.SingleBufferedImageStrategy$DrawingThread.run(SingleBufferedImageStrategy.java:252)
>
> So I tried to put in the layer the GridCoverage directly instead of the
> GeotiffReader,
> and then, i got this message :
>
> java.lang.AssertionError: GeneralEnvelope[(-40.72106049886832,
> -20.690664198797137), (-39.931656537188424, -19.945989698912875)]
> at
> org.geotools.geometry.GeneralEnvelope.intersect(GeneralEnvelope.java:918)
> at
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.paint(GridCoverageRenderer.java:471)
> at
> org.geotools.renderer.lite.StreamingRenderer.renderRaster(StreamingRenderer.java:1782)
> at
> org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:1710)
> at
> org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1656)
> at
> org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1600)
> at
> org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:644)
> at
> org.geotools.renderer.shape.ShapefileRenderer.renderWithStreamingRenderer(ShapefileRenderer.java:1456)
> at
> org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1325)
> at
> org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:266)
> at
> org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1481)
> at
> org.geotools.gui.swing.map.map2d.strategy.SingleBufferedImageStrategy.createBufferImage(SingleBufferedImageStrategy.java:132)
> [catch] at
> org.geotools.gui.swing.map.map2d.strategy.SingleBufferedImageStrategy$DrawingThread.run(SingleBufferedImageStrategy.java:252)
>
> I cant fix the problem...
> I can open the created geotiff in QGis with no problem, and can find this
> in
> the Properties/Metadatas :
>
> Driver:
>
> GTiff
> GeoTIFF
>
> Description du jeu de données
>
> C:\Documents and Settings\Thomas\Mes
> documents\NetBeansProjects\Vitoria\Coverages\coverage.TIF
>
> AREA_OR_POINT=Point
>
> Dimensions:
>
> X:947 Y:893Bandes:1
>
> Aucune valeur de données
>
> *NoDataValue not set*
>
> Type de Donnée:
>
> GDT_Byte - nombre entier non signé de huit bits
>
> Vues d'ensemble de pyramide:
>
> Système Spatial De Référence De la Couche:
>
> +proj=longlat +ellps=WGS84 +no_defs
>
> Origine:
>
> -40.7206,-19.9464
>
> Taille du Pixel:
>
> 0.000833584,-0.000833902
>
> Propriétés
>
> Valeur
>
> Bande
>
> 1 : Palette
>
> Bande No
>
> 1
>
> Pas de stats
>
> Pas de stats encore collectées
>
> If anybody gets an idea...
> Thanks in advance
> Thomas
>
> -------------------------------------------------------------------------
> 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
>
>
hi Anaxa Gore
i think you problem is a reprojection problem, your data are using a
differente coordinate system from which you you're using.
try to do something like this
map.getRenderingStrategy().setContext(mapcontext);
JMap2DNavigationBar navBar = new JMap2DNavigationBar();
navBar.setMap(map);
may be it will work
--
View this message in context:
http://www.nabble.com/Geotiff-writing-%2B-unable-to-re-open-them-tp17515136p17534369.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
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