Re: [Geoserver-users] WPS GridCoverage2D processes and NoData values

2018-11-17 Thread Andrea Aime
On Wed, Nov 14, 2018 at 5:20 PM ocox via Geoserver-users <
geoserver-users@lists.sourceforge.net> wrote:

> Hi,
>
> I'm working on a simple WPS process that subtracts one GridCoverage2D from
> another (I hope this code shows up ok).  But I can't seem to work out how
> to
> have the SubtractFromConst and Add operations respect the NoData values in
> the input GridCoverage2D.  I've looked through the Javadocs for the
> processors, but can't seem to find anything online.  Can anyone suggest
> anything I might be missing?
>

You normally don't see NoData handling in GeoServer code, it travels as
metadata of the raster data
and it's handled only if you have JAI-EXT enabled.
In summary:

   - Only JAI-EXT can recognize and deal with nodata, enable it following
   these instructions:
   
https://docs.geoserver.org/stable/en/user/configuration/image_processing/index.html#jai-ext
   - Make sure your source data has nodata (you can check with gdalinfo)
   and that GeoServer recognizes it
   - Make sure the operations that you're using are nodata enabled (the
   source code of
   
https://github.com/geosolutions-it/jai-ext/blob/0fa8a98879606c99cd1ce23d1d4a6a3323adc8e9/jt-algebra/src/main/java/it/geosolutions/jaiext/algebra/AlgebraOpImage.java
   seems to have nodata handling, but I cannot vouch for it)

Hope this helps

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information. == Ing. Andrea Aime @geowolf Technical Lead
GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39
0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
http://www.geo-solutions.it http://twitter.com/geosolutions_it
--- *Con riferimento
alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto, gli eventuali
allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
sarei comunque grato se potesse darmene notizia. This email is intended
only for the person or entity to which it is addressed and may contain
information that is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European Regulation 2016/679
“GDPR” - copying, dissemination or use of this e-mail or the information
herein by anyone other than the intended recipient is prohibited. If you
have received this email by mistake, please notify us immediately by
telephone or e-mail.*
___
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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


[Geoserver-users] WPS GridCoverage2D processes and NoData values

2018-11-14 Thread ocox via Geoserver-users
Hi,

I'm working on a simple WPS process that subtracts one GridCoverage2D from
another (I hope this code shows up ok).  But I can't seem to work out how to
have the SubtractFromConst and Add operations respect the NoData values in
the input GridCoverage2D.  I've looked through the Javadocs for the
processors, but can't seem to find anything online.  Can anyone suggest
anything I might be missing?  

Thanks,
Owen

 public GridCoverage2D execute(
@DescribeParameter(name = "coverageA", description = "First
input raster")
GridCoverage2D coverageA,
@DescribeParameter(name = "coverageB", description = "Second
input raster")
GridCoverage2D coverageB,
ProgressListener progressListener)
throws ProcessException {


BaseCoverageAlgebraProcess.checkCompatibleCoverages(coverageA,
coverageB);

final double[] constants = {0};

final ParameterValueGroup subParam =
PROCESSOR.getOperation("SubtractFromConst").getParameters();
 
subParam.parameter("source").setValue(coverageB);
subParam.parameter("constants").setValue(constants);

final ParameterValueGroup addParam =
PROCESSOR.getOperation("Add").getParameters();
addParam.parameter("source0").setValue(coverageA);
addParam.parameter("source1").setValue((GridCoverage2D)
PROCESSOR.doOperation(subParam));

return (GridCoverage2D) PROCESSOR.doOperation(addParam);
}




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


___
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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