[Geoserver-users] Maximum and minimum coverage evaluetion using org.geotools.coverage.processing.OperationJAI.Extrema

Hi list,
I’m trying to built a WPS to evaluate the basic statistic information of coverage data usign org.geotools.coverage.processing.OperationJAI.Extrema but minimum value is coincident with noData value (i.e. -9999, correctly reported as nodata by gdalinfo). Is there some method, in this class, to obtain the right minimum and maximum?

Thx

Luigi Marotta
IT Specialist - Ariespace s.r.l - Spin off Company
Università degli Studi di Napoli “Federico II”
Centro Direzionale IS. A3
80143 - Napoli - Italy
tel.: (+39) 08119564282
fax: (+39) 08119564223
mob.: (+39) 3478836273
skypecontact: live:luigi.marotta


PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e’ consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio e’ contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

The information in this e-mail is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify the sender immediately.

On Thu, Feb 6, 2014 at 4:29 PM, Luigi Marotta
<luigi.marotta@anonymised.com>wrote:

Hi list,
         I'm trying to built a WPS to evaluate the basic statistic
information of coverage data usign
org.geotools.coverage.processing.OperationJAI.Extrema but minimum value is
coincident with noData value (i.e. -9999, correctly reported as nodata by
gdalinfo). Is there some method, in this class, to obtain the right
minimum and maximum?

I don't think so, JAI does not have a concept of nodata

Cheers
Andrea

--
== Our support, Your Success! Visit http://opensdi.geo-solutions.it for
more information ==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

And you know some alternative way?
thx

···

Luigi Marotta
IT Specialist - Ariespace s.r.l - Spin off Company
Università degli Studi di Napoli “Federico II”
Centro Direzionale IS. A3
80143 - Napoli - Italy
tel.: (+39) 08119564282
fax: (+39) 08119564223
mob.: (+39) 3478836273
skypecontact: live:luigi.marotta


PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e’ consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio e’ contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

The information in this e-mail is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify the sender immediately.

2014-02-06 Andrea Aime <andrea.aime@anonymised.com>:

On Thu, Feb 6, 2014 at 4:29 PM, Luigi Marotta <luigi.marotta@anonymised.com> wrote:

Hi list,
I’m trying to built a WPS to evaluate the basic statistic information of coverage data usign org.geotools.coverage.processing.OperationJAI.Extrema but minimum value is coincident with noData value (i.e. -9999, correctly reported as nodata by gdalinfo). Is there some method, in this class, to obtain the right minimum and maximum?

I don’t think so, JAI does not have a concept of nodata

Cheers
Andrea

== Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information ==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Thu, Feb 6, 2014 at 5:36 PM, Luigi Marotta
<luigi.marotta@anonymised.com>wrote:

And you know some alternative way?

Implement your own JAI operation that is NODATA aware. Yes, this requires
coding :slight_smile:

Cheers
Andrea

--
== Our support, Your Success! Visit http://opensdi.geo-solutions.it for
more information ==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

Thx

···

Luigi Marotta
IT Specialist - Ariespace s.r.l - Spin off Company
Università degli Studi di Napoli “Federico II”
Centro Direzionale IS. A3
80143 - Napoli - Italy
tel.: (+39) 08119564282
fax: (+39) 08119564223
mob.: (+39) 3478836273
skypecontact: live:luigi.marotta


PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e’ consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio e’ contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

The information in this e-mail is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify the sender immediately.

2014-02-06 Andrea Aime <andrea.aime@anonymised.com>:

On Thu, Feb 6, 2014 at 5:36 PM, Luigi Marotta <luigi.marotta@anonymised.com> wrote:

And you know some alternative way?

Implement your own JAI operation that is NODATA aware. Yes, this requires coding :slight_smile:

Cheers

Andrea

== Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information ==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Ciao Luigi,
Going by memore, there si a zonal stats operation that could be instructed to’ take nodata values out of the computation.

I am putting One of our guys in the loop sa he will have more information.

Simone.

···

Luigi Marotta
IT Specialist - Ariespace s.r.l - Spin off Company
Università degli Studi di Napoli “Federico II”
Centro Direzionale IS. A3
80143 - Napoli - Italy
tel.: (+39) 08119564282
fax: (+39) 08119564223
mob.: (+39) 3478836273
skypecontact: live:luigi.marotta


PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e’ consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio e’ contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

The information in this e-mail is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify the sender immediately.

2014-02-06 Andrea Aime andrea.aime@anonymised.com:

On Thu, Feb 6, 2014 at 5:36 PM, Luigi Marotta luigi.marotta@anonymised.com wrote:

And you know some alternative way?

Implement your own JAI operation that is NODATA aware. Yes, this requires coding :slight_smile:

Cheers

Andrea

== Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information ==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Hi Luigi,
yesterday I was writing you this reply but there was a blackout in the whole building so… I have seen other guys already suggested something.
Sending anyway my email for further info, just in case…

The GT Extrema operation is based on JAI Extrema op which doesn’t support NoData so it doesn’t know that -9999 is a noData and therefore it returns that value as the minimum.
A workaround you may try is providing a ROI (Region Of Interest) based on a threshold value to exclude some regions of the input image from the computations.
http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/operator/ExtremaDescriptor.html

You can create a ROI on top of the input RenderedImage using a threshold value. Only pixels inside the ROI will be taken into account by statistics.
http://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/ROI.html#ROI%28java.awt.image.RenderedImage,%20int%29

As an instance, if -9999 is the minimum “bad” value and you know that all your values are >= A (Where A > -9999), you can do

ROI roi = new ROI(inputRenderedImage, A);

OperationJAI op=new OperationJAI(“Extrema”);
ParameterValueGroup params = op.getParameters();
params.parameter(“roi”).setValue(roi);

I know, that isn’t the optimal solution (especially for the ROI computation) but it may help.
Cheers,
Daniele

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Thu, Feb 6, 2014 at 4:29 PM, Luigi Marotta <luigi.marotta@anonymised.com> wrote:

Hi list,
I’m trying to built a WPS to evaluate the basic statistic information of coverage data usign org.geotools.coverage.processing.OperationJAI.Extrema but minimum value is coincident with noData value (i.e. -9999, correctly reported as nodata by gdalinfo). Is there some method, in this class, to obtain the right minimum and maximum?
Thx

Luigi Marotta
IT Specialist - Ariespace s.r.l - Spin off Company
Università degli Studi di Napoli “Federico II”
Centro Direzionale IS. A3
80143 - Napoli - Italy
tel.: (+39) 08119564282
fax: (+39) 08119564223
mob.: (+39) 3478836273
skypecontact: live:luigi.marotta


PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e’ consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio e’ contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

The information in this e-mail is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify the sender immediately.


Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi Luigi,

you can use the “ZonalStats” operation. It is an OperationJAI subclass which uses the JaiTools ZonalStatistics operation.

With this class you can calculate the Minimum and Maximum of the image and setting the right nodata value.

This class is located in the GeoTools module “gt-coverage” together with other operations (see the link: https://github.com/geotools/geotools/tree/master/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation).

The JaiTools ZonalStats documentation can be found here: http://jaitools.org/docs/jaitools/stable/apidocs/

Hope this will help.

Cheers,
Nicola

···

2014-02-07 Daniele Romagnoli <daniele.romagnoli@anonymised.com>:

Hi Luigi,
yesterday I was writing you this reply but there was a blackout in the whole building so… I have seen other guys already suggested something.
Sending anyway my email for further info, just in case…

The GT Extrema operation is based on JAI Extrema op which doesn’t support NoData so it doesn’t know that -9999 is a noData and therefore it returns that value as the minimum.
A workaround you may try is providing a ROI (Region Of Interest) based on a threshold value to exclude some regions of the input image from the computations.
http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/operator/ExtremaDescriptor.html

You can create a ROI on top of the input RenderedImage using a threshold value. Only pixels inside the ROI will be taken into account by statistics.
http://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/ROI.html#ROI%28java.awt.image.RenderedImage,%20int%29

As an instance, if -9999 is the minimum “bad” value and you know that all your values are >= A (Where A > -9999), you can do

ROI roi = new ROI(inputRenderedImage, A);

OperationJAI op=new OperationJAI(“Extrema”);
ParameterValueGroup params = op.getParameters();
params.parameter(“roi”).setValue(roi);

I know, that isn’t the optimal solution (especially for the ROI computation) but it may help.
Cheers,
Daniele

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Thu, Feb 6, 2014 at 4:29 PM, Luigi Marotta <luigi.marotta@anonymised.com> wrote:

Hi list,
I’m trying to built a WPS to evaluate the basic statistic information of coverage data usign org.geotools.coverage.processing.OperationJAI.Extrema but minimum value is coincident with noData value (i.e. -9999, correctly reported as nodata by gdalinfo). Is there some method, in this class, to obtain the right minimum and maximum?
Thx

Luigi Marotta
IT Specialist - Ariespace s.r.l - Spin off Company
Università degli Studi di Napoli “Federico II”
Centro Direzionale IS. A3
80143 - Napoli - Italy
tel.: (+39) 08119564282
fax: (+39) 08119564223
mob.: (+39) 3478836273
skypecontact: live:luigi.marotta


PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e’ consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio e’ contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

The information in this e-mail is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify the sender immediately.


Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.com.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Nicola Lagormarsini
Junior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it