Converting a GridEnvelope to an Envelope

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

Converting a GridEnvelope to an Envelope

Reply Threaded More More options
Print post
Permalink
Is there a shortcut to convert a GridEnvelope to an Envelope?  It used to be possible to do this:
                final Envelope gridRange = new GeneralEnvelope(
                        originalGridRange.toRectangle());
This snippet was taken from line ~525 in JP2KReader which doesn't compile anymore.  toRectangle() is not there anymore.  I'm trying to resurrect this code.

~ David Smiley
mbedward

Re: Converting a GridEnvelope to an Envelope

Reply Threaded More More options
Print post
Permalink
Hello David,

Between JTS, GeoTools and GeoAPI there's an embarrassment of riches
when it comes to envelopes isn't there ?  Or, for some of us (me
included), a maze that's all too easy to get lost in...

I'm not familiar with JP2KReader so could you specify what sort of
Envelope you have (want) on either side of your assignment ?

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
David Smiley (@MITRE.org)

Re: Converting a GridEnvelope to an Envelope

Reply Threaded More More options
Print post
Permalink
Indeed; it's quite confusing.
Sorry if I wasn't clear enough... I have a GridEnvelope.  It could be any implementing type in the general case but in my particular case I know it happens to be an instance of org.geotools.coverage.grid.GeneralGridEnvelope. And I want a org.opengis.geometry.Envelope.  If I assume that my source type is specifically GeneralGridEnvelope then I can cast it to this and call toRectangle() and give this to a constructor of GeneralEnvelope.  It doesn't seem good to make this assumption, however.  This struck me as something that would probably exist in some utility class or some constructor or factory I was unaware of.  I'm not sure.  I could pull out the components of GridEnvelope (getSpan(), getHigh(), getLow(),...) but that seems like something someone else would have done already and I might resuse it.  Perhaps not.

~ David
________________________________________
From: Michael Bedward [[hidden email]]
Sent: Thursday, October 15, 2009 10:03 PM
To: Smiley, David W.
Cc: [hidden email]
Subject: Re: [Geotools-gt2-users] Converting a GridEnvelope to an Envelope

Hello David,

Between JTS, GeoTools and GeoAPI there's an embarrassment of riches
when it comes to envelopes isn't there ?  Or, for some of us (me
included), a maze that's all too easy to get lost in...

I'm not familiar with JP2KReader so could you specify what sort of
Envelope you have (want) on either side of your assignment ?

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
mbedward

Re: Converting a GridEnvelope to an Envelope

Reply Threaded More More options
Print post
Permalink
Hi David,

Hopefully someone will correct me if I'm wrong but I don't think there
is any shortcut method written to create an
org.opengis.geometry.Envelope from a GridEnvelope.

In general they exist in separate domains, the first in geographic /
world coordinate space and the second in raster / image space.

When I've worked with grid coverages in plain cartesian space (no CRS)
I've set the world bounds long hand.

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