Hi Victor,
as far as I can see the function is not null safe:

https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/InterpolateFunction.java#L245

If you want a quick workaround, you should be able to just filter out null
values with a negated PropertyIsNull filter.
Since you are familiar with the geotools code base, I'd also consider the
option of fixing the issue, usual procedure, ticket, pull request
with tests: https://github.com/geotools/geotools/blob/master/CONTRIBUTING.md
I glanced over the SE specification (this function originates there), I
cannot exactly tell what it was meant to do against a null input. There is
a fallback value attribute, and it's meant to be
used as a static value for SE implementations not implementing the
functions... not sure, I see two options:

   - If the input is null, the output is null (that's what many other null
   safe functions are doing)
   - If the input is null and the fallback value is available, use that one
   (the editor thought it was a good fallback after all)


Cheers
Andrea


On Tue, Sep 20, 2016 at 9:18 AM, <victor....@csiro.au> wrote:

> Hi, I am trying to style a wms based on the transformation function found
> on http://docs.geoserver.org/stable/en/user/styling/sld-
> tipstricks/transformation-func.html with the GS build listed below. I end
> up with a nullpointerexception. If I replace the interpolate function with
> a simple <CssParameter name="fill">#FF0000</CssParameter>, everything
> works fine. Is it a restriction with using the function with a
> PointSymbolizer or am I missing something else. Please advise.
>
>
>
> Thank you.
>
>
>
> GS Build:
>
> ·         Version2.6.0
>
> ·         Git Revision6bd64f68b435fadcdc6656e82a76852e504b2c72
>
> ·         Build Date26-Sep-2014 16:00
>
> ·         GeoTools Version12.0 (rev 645963cd65a6f5c151722ce012f2a4
> a6d3b86a44)
>
> ·         GeoWebCache Version1.6.0 (rev 1.6.x/
> 8beca4056f2c4873adbf6758b2ab12f65cebf7a0)
>
>
>
> ERROR:
>
> Caused by: java.lang.NullPointerException
>
>         at org.geotools.filter.function.InterpolateFunction.evaluate(
> InterpolateFunction.java:245)
>
>         at org.geotools.renderer.style.SLDStyleFactory.evalToColor(
> SLDStyleFactory.java:1544)
>
>         at org.geotools.renderer.style.SLDStyleFactory.getPaint(
> SLDStyleFactory.java:1029)
>
>         at org.geotools.renderer.style.SLDStyleFactory.createMarkStyle(
> SLDStyleFactory.java:678)
>
>         at org.geotools.renderer.style.SLDStyleFactory.createPointStyle(
> SLDStyleFactory.java:642)
>
>         at org.geotools.renderer.style.SLDStyleFactory.createPointStyle(
> SLDStyleFactory.java:517)
>
>         at org.geotools.renderer.style.SLDStyleFactory.
> createStyleInternal(SLDStyleFactory.java:373)
>
>         at org.geotools.renderer.style.SLDStyleFactory.createStyle(
> SLDStyleFactory.java:320)
>
>         at org.geotools.renderer.lite.StreamingRenderer.
> processSymbolizers(StreamingRenderer.java:2612)
>
>         at org.geotools.renderer.lite.StreamingRenderer.process(
> StreamingRenderer.java:2515)
>
>         at org.geotools.renderer.lite.StreamingRenderer.drawPlain(
> StreamingRenderer.java:2348)
>
>         at org.geotools.renderer.lite.StreamingRenderer.processStylers(
> StreamingRenderer.java:2053)
>
>         at org.geotools.renderer.lite.StreamingRenderer.paint(
> StreamingRenderer.java:814)
>
>         at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(
> RenderedImageMapOutputFormat.java:489)
>
>
>
> SLD used:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://
> www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="
> http://www.opengis.net/sld"; xmlns:public="http://capdf.csiro.au/";
> xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.
> net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:ows="
> http://www.opengis.net/ows"; xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance">
>
>                 <NamedLayer>
>
>                                 <Name>public:XXXX</Name>
>
>                                 <UserStyle>
>
>                                                 <Title>default
> Title</Title>
>
>                                                 <Abstract>default
> abstract</Abstract>
>
>                                                 <FeatureTypeStyle>
>
>                                                                 <Rule>
>
>
> <Name>XXXX</Name>
>
>
> <Title>XXXX</Title>
>
>
> <Abstract>Light purple square boxes</Abstract>
>
>
> <PointSymbolizer>
>
>
>                                     <Graphic>
>
>
>                                                     <Mark>
>
>
>
> <WellKnownName>circle</WellKnownName>
>
>
>                                                                     <Fill>
>
>
>
> <CssParameter name="fill">
>
>
>
>                                         <ogc:Function name="Interpolate">
>
>
>
>
> <ogc:PropertyName>T</ogc:PropertyName>
>
>
>
>
> <ogc:Literal>4</ogc:Literal>
>
>
>
>
> <ogc:Literal>#fefeee</ogc:Literal>
>
>
>
>
> <ogc:Literal>36</ogc:Literal>
>
>
>
>
> <ogc:Literal>#ff0000</ogc:Literal>
>
>
>
>
> <ogc:Literal>color</ogc:Literal>
>
>
>
>                                         </ogc:Function>
>
>
>
> </CssParameter>
>
>
>
> </Fill>
>
>
>                                                     </Mark>
>
>
>                                                     <Size>6</Size>
>
>
>                                     </Graphic>
>
>
> </PointSymbolizer>
>
>                                                                 </Rule>
>
>                                                 </FeatureTypeStyle>
>
>                                 </UserStyle>
>
>                 </NamedLayer>
>
> </StyledLayerDescriptor>
>
>
>
>
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>


-- 
==
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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Reply via email to