[geotk] Grib file coordinate transformation

Pablo Rozas Larraondo p.rozas.larraondo at gmail.com
Mon Jan 30 14:07:39 EST 2012


Hello,

I'm trying to access the data of a GRIB file using lat, lon coordinates.
I've defined a ProjectedCRS modifying some parameters of the Lambert Conic
Conformal (1SP) projection to adjust it to the one used in my GRIB file.
This is my code:


            GridCoverage coverage = CoverageIO.read("~/myfile.grb");
            GridCoverage2D gc2D = (GridCoverage2D) coverage;
            float[] values=null;
            values = gc2D.evaluate(new Point2D.Float(600, -420), values);

            MathTransformFactory mtFactory =
FactoryFinder.getMathTransformFactory(null);
            ParameterValueGroup p = mtFactory.getDefaultParameters("Lambert
Conic Conformal (1SP)");
            p.parameter("Latitude of natural origin").setValue(40);
            p.parameter("Longitude of natural origin").setValue(-2.5);
            Conversion conversion = new DefiningConversion("Harmonie_ES",
p);

            CRSFactory crsFactory = FactoryFinder.getCRSFactory(null);
            Map<String,?> properties =
Collections.singletonMap(ProjectedCRS.NAME_KEY, "Harmonie_ES");
            GeographicCRS baseCRS = DefaultGeographicCRS.WGS84;
            CartesianCS projectedCS = DefaultCartesianCS.PROJECTED;
            ProjectedCRS crs = crsFactory.createProjectedCRS(properties,
baseCRS, conversion, projectedCS);


Does anybody knows how to use the ProjectedCRS to transform my
GridCoverage2D and being able to evaluate points using lat, lon coordinates?

Thanks for your help,

Pablo Rozas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20120130/f20517e5/attachment.html


More information about the Geotoolkit mailing list