Hi Rainer,

I've been doing similar work recently, and I've been using ReferencedEnvelope in the construction of my GridCoverage.

Matt


Rainer Suddendorf wrote:
Hi,

I want render a tiff file.
It works perfectly with geotiff files.

But when Iget the coordinates and resolution from an .tfw, I have to set the Coordinatereferencesystem.

How do I set the CRS manually?

I tried the following, but the GridCoverage does not inherit the CRS from CRSEnvelope.

    public static void main(String[] args) throws Exception {
        String name = args[0];
        Style style = JMapStyles.getRasterStyle(1.0);
        GridCoverageFactory gcFactory = new GridCoverageFactory();
        double dist =1000.0;
        double x=3544563.0;
        double y = 5789834.0;
        CRSEnvelope envelope =
            new CRSEnvelope("31467", x,y,x+dist,y+dist);

        GridCoverage2D gridCoverage = gcFactory.create(name, getImage(name), envelope);
       
        Object o = gridCoverage.getCoordinateReferenceSystem();
        if ( o.equals (
CRS.decode("EPSG:31467")){
            System.out.println("That wolud be nice, but I never get here");
        }

        System.out.out(o);
    }

The output:

GEOGCS["WGS84",
  DATUM["WGS84",
    SPHEROID["WGS84", 6378137.0, 298.257223563]],
  PRIMEM["Greenwich", 0.0],
  UNIT["degree", 0.017453292519943295],
  AXIS["Geodetic longitude", EAST],
  AXIS["Geodetic latitude", NORTH]]

I am using geotools 2.4.3.

Thanks for your help.

Rainer


------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php

_______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

-- 
The cosmos is all that is or ever was or ever will be.
-- Carl Sagan


begin:vcard
fn:Matt Foster - N0EYE
n:Foster;Matt
org:;NWS Forecast Office - Norman OK
email;internet:[EMAIL PROTECTED]
title:Information Technology Officer
tel;work:(405) 325-3406
x-mozilla-html:TRUE
version:2.1
end:vcard

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to