On Mon, Jan 16, 2012 at 5:25 PM, Andreas Wagner <[email protected]>wrote:

> 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.
>

As far as I know in order to publish over to Google Maps you need
a server that can talk either the Google Maps tile protocol or WMS,
you cannot just send over a GeoTiff.

GeoServer can do WMS, and its integrated GeoWebCache can do
the Google Maps protocol as far as I remember.


>
> 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?
>

Not sure, since I'm not familiar with the GridCoverageBuilder class, but I
don't
see you seeting the actual raster data anywhere?

Have a look at the docs for other ways to create a grid coverage:
http://docs.geotools.org/latest/userguide/library/coverage/grid.html

Cheers
Andrea

-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:    +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to