Hi there.
I'm trying to create GeoTIFF file based on a plain TIFF file and a
bounding box. This GeoTIFF file should be put on top of a Google maps
background layer and stored as a png, jpg or similar picture to the
filesystem.
By now, I only have the part where the GeoTIFF file is written. It looks
as following:
Image img = ...
File outputfile = File.createTempFile( "heatmap", ".tiff" );
ImageIO.write(img, "tiff", outputfile);
final GeoTiffFormat format = new GeoTiffFormat();
final GridCoverageWriter writer = format.getWriter(outputfile);
GridCoverageBuilder g = new GridCoverageBuilder();
g.setCoordinateReferenceSystem( CRS.decode("EPSG:4326") );
g.setEnvelope(Math.min( easternmostLong, westernmostLong), Math.max(
easternmostLong, westernmostLong),
Math.min( northernmostLat, southernmostLat), Math.max( northernmostLat,
southernmostLat)); //which is (7.796245724651746, 7.801315175348255,
52.62908449067879, 52.63202060932121)
writer.write(g.getGridCoverage2D(), null);
However, I get
java.lang.IllegalArgumentException: Argument "name" should not be null.
at org.geotools.coverage.Category.ensureNonNull(Category.java:914)
at org.geotools.coverage.Category.<init>(Category.java:442)
at org.geotools.coverage.Category.<init>(Category.java:428)
at
org.geotools.coverage.grid.RenderedSampleDimension.create(RenderedSampleDimension.java:334)
at
org.geotools.coverage.grid.RenderedSampleDimension.create(RenderedSampleDimension.java:138)
at
org.geotools.coverage.grid.GridCoverage2D.<init>(GridCoverage2D.java:234)
at
org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:591)
at
org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:515)
at
org.geotools.coverage.grid.GridCoverageBuilder.getGridCoverage2D(GridCoverageBuilder.java:423)
at
de.dfki.km.igreen.onlinebox.isoxml.util.GridBuilderListener.storeImage(GridBuilderListener.java:306)
Line 306 is the last line of my pasted code, where the write() method is
called.
What is the problem here?
How can I fix this and combine the image with a Google maps background
layer?
Any help is kindly appreciated.
Kind Regards,
Andreas
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users