Getting corner lat/lon box from GridCoverage2D

6 messages Options
Embed this post
Permalink
David Smiley (@MITRE.org)

Getting corner lat/lon box from GridCoverage2D

Reply Threaded More More options
Print post
Permalink
Hello.  I've used a GridCoverageReader and called read(null) to get the GridCoverage object.  The subclass is is actually a GridCoverage2D instance.  I've assumed this data to be a box oriented without rotation so I should be able to get a pair of latitudes and longitudes.  I have no idea how to do this; the GeoTools API is very confusing to me.  This is probably very easy to do.  Can anyone help me?

By the way, I'm using JP2KReader which reads GeoTiff headers inside Jpeg2000 files.  I've modified it to use JAI ImageIO (i.e. Sun's code) instead of Kakadu.

~ David Smiley
Jody Garnett-2

Re: Getting corner lat/lon box from GridCoverage2D

Reply Threaded More More options
Print post
Permalink
Hi David; going to be hard to get any questions answered this week  
with foss4g.

Check the user guide for information on the CRS utility class; this  
will allow you to take your BoundingBox corners and convert them into  
lat/long.

Jody

On 21/10/2009, at 1:56 AM, David Smiley (@MITRE.org) wrote:

>
> Hello.  I've used a GridCoverageReader and called read(null) to get  
> the
> GridCoverage object.  The subclass is is actually a GridCoverage2D  
> instance.
> I've assumed this data to be a box oriented without rotation so I  
> should be
> able to get a pair of latitudes and longitudes.  I have no idea how  
> to do
> this; the GeoTools API is very confusing to me.  This is probably  
> very easy
> to do.  Can anyone help me?
>
> By the way, I'm using JP2KReader which reads GeoTiff headers inside  
> Jpeg2000
> files.  I've modified it to use JAI ImageIO (i.e. Sun's code)  
> instead of
> Kakadu.
>
> ~ David Smiley
> --
> View this message in context: http://n2.nabble.com/Getting-corner-lat-lon-box-from-GridCoverage2D-tp3859086p3859086.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
David Smiley (@MITRE.org)

Re: Getting corner lat/lon box from GridCoverage2D

Reply Threaded More More options
Print post
Permalink
Hi!
This page?:
http://docs.codehaus.org/display/GEOTDOC/01+CRS+Helper+Class

It wasn't helpful.  It doesn't even reference GridCoverage nor does  
the javadocs for the CRS class.

~ David

On Oct 20, 2009, at 3:48 PM, Jody Garnett wrote:

> Hi David; going to be hard to get any questions answered this week
> with foss4g.
>
> Check the user guide for information on the CRS utility class; this
> will allow you to take your BoundingBox corners and convert them into
> lat/long.
>
> Jody
>
> On 21/10/2009, at 1:56 AM, David Smiley (@MITRE.org) wrote:
>
>>
>> Hello.  I've used a GridCoverageReader and called read(null) to get
>> the
>> GridCoverage object.  The subclass is is actually a GridCoverage2D
>> instance.
>> I've assumed this data to be a box oriented without rotation so I
>> should be
>> able to get a pair of latitudes and longitudes.  I have no idea how
>> to do
>> this; the GeoTools API is very confusing to me.  This is probably
>> very easy
>> to do.  Can anyone help me?
>>
>> By the way, I'm using JP2KReader which reads GeoTiff headers inside
>> Jpeg2000
>> files.  I've modified it to use JAI ImageIO (i.e. Sun's code)
>> instead of
>> Kakadu.
>>
>> ~ David Smiley
>> --
>> View this message in context: http://n2.nabble.com/Getting-corner-lat-lon-box-from-GridCoverage2D-tp3859086p3859086.html
>> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart
>> your
>> developing skills, take BlackBerry mobile applications to market and
>> stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett-2

Re: Getting corner lat/lon box from GridCoverage2D

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I see; I thought you would look at what grid coverage provided by way of extent information. Once you have a Envelope2D you will want to take the position and transform it into WGS84; for which the CRS utility will help you.

Envelope2D bounds = coverage.getEnvelope2D();
MathTransform transform= CRS.findMathTransform( coverage.getCoordinateReferenceSystem(), DefaultGeographicCRS.WGS84 );


And then use the transform to change bounds.getLowerCorner() to WGS84.


Jody        


On 21/10/2009, at 7:02 AM, Smiley, David W. wrote:

Hi!
This page?:
http://docs.codehaus.org/display/GEOTDOC/01+CRS+Helper+Class

It wasn't helpful.  It doesn't even reference GridCoverage nor does  
the javadocs for the CRS class.

~ David

On Oct 20, 2009, at 3:48 PM, Jody Garnett wrote:

Hi David; going to be hard to get any questions answered this week
with foss4g.

Check the user guide for information on the CRS utility class; this
will allow you to take your BoundingBox corners and convert them into
lat/long.

Jody

On 21/10/2009, at 1:56 AM, David Smiley (@MITRE.org) wrote:


Hello.  I've used a GridCoverageReader and called read(null) to get
the
GridCoverage object.  The subclass is is actually a GridCoverage2D
instance.
I've assumed this data to be a box oriented without rotation so I
should be
able to get a pair of latitudes and longitudes.  I have no idea how
to do
this; the GeoTools API is very confusing to me.  This is probably
very easy
to do.  Can anyone help me?

By the way, I'm using JP2KReader which reads GeoTiff headers inside
Jpeg2000
files.  I've modified it to use JAI ImageIO (i.e. Sun's code)
instead of
Kakadu.

~ David Smiley
--
View this message in context: http://n2.nabble.com/Getting-corner-lat-lon-box-from-GridCoverage2D-tp3859086p3859086.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
David Smiley (@MITRE.org)

Re: Getting corner lat/lon box from GridCoverage2D

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Thanks.  Using the transform seemed a bit low-level.  After poking around a bit I found it easier to do this:
GridCoverage2D coverage = gridCoverageReader.read(null);
ReferencedEnvelope latLonEnvelope = new ReferencedEnvelope(coverage.getEnvelope()).transform(DefaultGeographicCRS.WGS84,false)

~ David
On Oct 20, 2009, at 6:36 PM, Jody Garnett wrote:

I see; I thought you would look at what grid coverage provided by way of extent information. Once you have a Envelope2D you will want to take the position and transform it into WGS84; for which the CRS utility will help you.

Envelope2D bounds = coverage.getEnvelope2D();
MathTransform transform= CRS.findMathTransform( coverage.getCoordinateReferenceSystem(), DefaultGeographicCRS.WGS84 );

And then use the transform to change bounds.getLowerCorner() to WGS84.

Jody        

On 21/10/2009, at 7:02 AM, Smiley, David W. wrote:

Hi!
This page?:
http://docs.codehaus.org/display/GEOTDOC/01+CRS+Helper+Class

It wasn't helpful.  It doesn't even reference GridCoverage nor does  
the javadocs for the CRS class.

~ David

On Oct 20, 2009, at 3:48 PM, Jody Garnett wrote:

Hi David; going to be hard to get any questions answered this week
with foss4g.

Check the user guide for information on the CRS utility class; this
will allow you to take your BoundingBox corners and convert them into
lat/long.

Jody

On 21/10/2009, at 1:56 AM, David Smiley (@MITRE.org) wrote:


Hello.  I've used a GridCoverageReader and called read(null) to get
the
GridCoverage object.  The subclass is is actually a GridCoverage2D
instance.
I've assumed this data to be a box oriented without rotation so I
should be
able to get a pair of latitudes and longitudes.  I have no idea how
to do
this; the GeoTools API is very confusing to me.  This is probably
very easy
to do.  Can anyone help me?

By the way, I'm using JP2KReader which reads GeoTiff headers inside
Jpeg2000
files.  I've modified it to use JAI ImageIO (i.e. Sun's code)
instead of
Kakadu.

~ David Smiley
--
View this message in context: http://n2.nabble.com/Getting-corner-lat-lon-box-from-GridCoverage2D-tp3859086p3859086.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users





------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: Getting corner lat/lon box from GridCoverage2D

Reply Threaded More More options
Print post
Permalink
Hi David,

Yes, that's a nice way of doing it.

In case you also need to do any conversions between grid (pixel) and
world coordinates, you'll find helpful methods in the GridGeometry2D
class.  You can get at this by:

  mycoverage.getGridGridGeometry();

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users