[Geoserver-users] GridCoverage2D and SRS

Hi,

I created a GridCoverage2D using the GeoTools API and wrote the
GridCoverage2D as follows:

final GridCoverageFactory geoTiffFactory = new GridCoverageFactory();

final RenderedImage image = ImageIO.read(this.jpegFile);

final GeneralEnvelope envelope = new
GeneralEnvelope(this.boundingBox.getLowerLeftCoordinate(),
this.boundingBox.getUpperRightCoordinate());

envelope.setCoordinateReferenceSystem(new
DefaultGeographicCRS(DefaultGeographicCRS.WGS84));

final GridCoverage2D geoTiff =
geoTiffFactory.create(this.geoTiffFile.getName(), image, envelope);

final GeoTiffWriter geoTiffWriter = new GeoTiffWriter(this.geoTiffFile);

ProductProcessor.logger.info("Generating GeoTiff at " +
this.geoTiffFile);

geoTiffWriter.write(geoTiff, null);

I then try to load this GeoTiff into Geoserver and notice that Geoserver
says that the SRS field of the GeoTiff is UNKNOWN. I see that it indeed
shows the bounding box correct and the CRS as WGS84.

How do I specify the SRS (Spatial Reference System) value??

Ronak Patel

Senior Software Engineer

BAE Systems NS

San Diego, CA

Ciao Ronak,

you set the geotiff this way

envelope.setCoordinateReferenceSystem(new
DefaultGeographicCRS(DefaultGeographicCRS.WGS84));

This is a default representation of the WGS84 crs which has not EPSG
code attached hence geoserver tells you that the EPSG code is unknwon.

You should create a crs by doing CRS.decode("EPSG:4326",true) which
ensure you to have an EPSG code and the right (let's say so) axis
order.

Simone.

-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Owner - Software Engineer
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it
http://simboss.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini

-------------------------------------------------------

On Tue, Apr 28, 2009 at 4:35 AM, Patel, Ronak Avinash (US SSA)
<ronak.patel@anonymised.com> wrote:

Hi,

I created a GridCoverage2D using the GeoTools API and wrote the
GridCoverage2D as follows:

final GridCoverageFactory geoTiffFactory = new GridCoverageFactory();

final RenderedImage image = ImageIO.read(this.jpegFile);

final GeneralEnvelope envelope = new
GeneralEnvelope(this.boundingBox.getLowerLeftCoordinate(),
this.boundingBox.getUpperRightCoordinate());

envelope.setCoordinateReferenceSystem(new
DefaultGeographicCRS(DefaultGeographicCRS.WGS84));

final GridCoverage2D geoTiff =
geoTiffFactory.create(this.geoTiffFile.getName(), image, envelope);

final GeoTiffWriter geoTiffWriter = new GeoTiffWriter(this.geoTiffFile);

ProductProcessor.logger.info("Generating GeoTiff at " + this.geoTiffFile);

geoTiffWriter.write(geoTiff, null);

I then try to load this GeoTiff into Geoserver and notice that Geoserver
says that the SRS field of the GeoTiff is UNKNOWN. I see that it indeed
shows the bounding box correct and the CRS as WGS84.

How do I specify the SRS (Spatial Reference System) value??

Ronak Patel

Senior Software Engineer

BAE Systems NS

San Diego, CA

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users