Histogram Op and RGB images

4 messages Options
Embed this post
Permalink
Gabriel Roldan

Histogram Op and RGB images

Reply Threaded More More options
Print post
Permalink
Hi Simone,

I've been trying to use the
org.geotools.coverage.processing.operation.Histogram operation against
the sample geoserver coverages and the only one it works for the DEM.
Problem being an NPE thrown at

java.lang.ClassCastException: [Ljava.lang.Object;
        at
org.geotools.coverage.processing.OperationJAI.deriveSampleDimension(OperationJAI.java:781)
        at
org.geotools.coverage.processing.OperationJAI.deriveGridCoverage(OperationJAI.java:580)
..

This is due to the coverage not defining any geophysics category and
OperationJAI checking for null category list but not for an empty one.
The following patch seems to solve the problem. Do you think it's
alright? I might be missing something fundamental, as I only tried what
seemed obvious.

Index: src/main/java/org/geotools/coverage/processing/OperationJAI.java
===================================================================
--- src/main/java/org/geotools/coverage/processing/OperationJAI.java
(revision 34115)
+++ src/main/java/org/geotools/coverage/processing/OperationJAI.java
(working copy)
@@ -774,7 +774,7 @@
                  sampleDim = allBands[allBands.length == 1 ? 0 : numBands];
                  final List<Category> categories =
sampleDim.getCategories();
                  // GridSampleDimension may contain no categories
-                if (categories == null) {
+                if (categories == null || categories.size() == 0) {
                      result[numBands] = sampleDim;
                      continue;
                  }


Cheers,
Gabriel

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
mbedward

Re: Histogram Op and RGB images

Reply Threaded More More options
Print post
Permalink
Hi Gabriel,

Excuse me butting in but I know Simone is super busy and I've got an
interest in the coverage module myself.

Your fix seems fine to me.  I'll do a jira and commit it.

cheers
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Simone Giannecchini

Re: Histogram Op and RGB images

Reply Threaded More More options
Print post
Permalink
Thanks for fixing this Michael!

Simone.
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder - Software Engineer
Via Carignoni 51
55041  Camaiore (LU)
Italy

phone: +39 0584983027
fax:      +39 0584983027
mob:    +39 333 8128928


http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://simboss.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini

-------------------------------------------------------



On Tue, Oct 13, 2009 at 8:52 AM, Michael Bedward
<[hidden email]> wrote:

> Hi Gabriel,
>
> Excuse me butting in but I know Simone is super busy and I've got an
> interest in the coverage module myself.
>
> Your fix seems fine to me.  I'll do a jira and commit it.
>
> cheers
> 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-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Gabriel Roldan

Re: Histogram Op and RGB images

Reply Threaded More More options
Print post
Permalink
In reply to this post by mbedward
Great, thanks Michael.

Gabriel
Michael Bedward wrote:
> Hi Gabriel,
>
> Excuse me butting in but I know Simone is super busy and I've got an
> interest in the coverage module myself.
>
> Your fix seems fine to me.  I'll do a jira and commit it.
>
> cheers
> Michael


--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel