Hello Henry,

If you are brand new to GeoTools I'd recommend looking at some of the
tutorials first to get a handle on basic concepts and terms...

http://docs.geotools.org/latest/userguide/tutorial/

You can create a GridCoverage2D object from your raster data like this...

public GridCoverage2D createCoverage(float[][] raster,
        double minWorldX, double maxWorldX,
        double minWorldY, double maxWorldY,
        CoordinateReferenceSystem crs) {

    GridCoverageFactory gcf =
CoverageFactoryFinder.getGridCoverageFactory(null);

    // It's not necessary to have a reference system defined but I like to
    if (crs == null) {
        crs = DefaultEngineeringCRS.GENERIC_2D;
    }

    ReferencedEnvelope env = new ReferencedEnvelope(
            minWorldX, maxWorldX,
            minWorldY, maxWorldY,
            crs);

    return gcf.create("MyCoverage", matrix, env);
}

If your data are not float and you don't want to convert them to that
type, you can create a Java RenderedImage from your data first, and
then pass that to the GridCoverageFactory to create the coverage. For
example, here's how to do that with double data...

        WritableRaster raster = RasterFactory.createBandedRaster(
                DataBuffer.TYPE_DOUBLE,
                numMatrixCols, numMatrixRows,
                1, new java.awt.Point(0, 0));

        GridCoverage2D cov = gcf.create("MyCoverage", raster,
                new ReferencedEnvelope(minWorldX, maxWorldX,
minWorldY, maxWorldY, crs);

When you've got that working, have a look at the ImageTutorial for a
very basic introduction to displaying the grid coverage:

http://docs.geotools.org/latest/userguide/tutorial/raster/image.html

After that, you'll probably want to get back to the list to discuss
creating display styles etc.

Hope this helps,
Michael

2011/11/16 Henry Piñeros <[email protected]>:
> Hi all.
> I'm new in GeoTools. I have a  ASCII matrix from a simulation in Java. I
> want to display my matrix like a raster map on GeoTools (Or load the ascci
> matrix on GeotTools)
> Could I do this with GeoTools??
> Help me!! I just need a few indications
> Thanks before hands.
> Apologies for my english!!
>
> --
> Estudiante de Ingenieria de Sistemas e Informatica
>              Univesidad Nacional de Colombia
>                          Sede Medellin
>                                 2011
>
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to