[Geoserver-users] <ogc:Filter> for numeric NaN value

I use Geoserver for rendering Imagery and Vector data. I have a PostGIS
table with a numeric type which has "NaN" values. I am creating SLD for
this vector data and not sure how to setup <ogc:Filter> for this value. I
have tried the followings and they don't seem to work:

<ogc:PropertyIsNull><ogc:PropertyName>hdp</ogc:PropertyName></ogc:PropertyIsNull>
- This returned no results.

<ogc:PropertyIsEqualTo><ogc:PropertyName>hdp</ogc:PropertyName><ogc:Literal>NaN</ogc:Literal></ogc:PropertyIsEqualTo>
- This gives the following error:
Caused by: org.postgresql.util.PSQLException: ERROR: column "nan" does not
exist

What is the correct way to handle this NaN value? Many thanks in advance.

Regards,
Tam

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/ogc-Filter-for-numeric-NaN-value-tp5146135.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I notice that the IsEqualsToImpl does make allowances for NaN:

return (fp1 == fp2) || (Double.isNaN(fp1) && Double.isNaN(fp2));

See https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/IsEqualsToImpl.java#L126

However I cannot see any test case showing how to make Double.NaN in NumericConverterFactoryTest (which is responsible for turning strings into numbers if required).

Sounds like you may have a bug report to make, for now try using an else rule to render anything that falls through the cracks.

···

Jody Garnett

On Tue, Jun 17, 2014 at 1:41 AM, tt5430 <tt9488@anonymised.com> wrote:

I use Geoserver for rendering Imagery and Vector data. I have a PostGIS
table with a numeric type which has “NaN” values. I am creating SLD for
this vector data and not sure how to setup ogc:Filter for this value. I
have tried the followings and they don’t seem to work:

ogc:PropertyIsNullogc:PropertyNamehdp</ogc:PropertyName></ogc:PropertyIsNull>

  • This returned no results.

ogc:PropertyIsEqualToogc:PropertyNamehdp</ogc:PropertyName>ogc:LiteralNaN</ogc:Literal></ogc:PropertyIsEqualTo>

  • This gives the following error:
    Caused by: org.postgresql.util.PSQLException: ERROR: column “nan” does not
    exist

What is the correct way to handle this NaN value? Many thanks in advance.

Regards,
Tam


View this message in context: http://osgeo-org.1560.x6.nabble.com/ogc-Filter-for-numeric-NaN-value-tp5146135.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems


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

On Tue, Jun 17, 2014 at 11:03 AM, Jody Garnett <jody.garnett@anonymised.com>
wrote:

I notice that the IsEqualsToImpl does make allowances for NaN:

return (fp1 == fp2) || (Double.isNaN(fp1) && Double.isNaN(fp2));

See
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/IsEqualsToImpl.java#L126

However I cannot see any test case showing how to make Double.NaN
in NumericConverterFactoryTest (which is responsible for turning strings
into numbers if required).

Sounds like you may have a bug report to make, for now try using an else
rule to render anything that falls through the cracks.

Another, maybe more explicit way to handle this would be to add a filter
function
that allows to check if a number is a NaN among the math functions:
http://docs.geoserver.org/stable/en/user/filter/function_reference.html#math-functions
(e.g., isNaN(myProperty))

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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

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

I was kind of hoping “NaN” would work - since it is supported by Double.valueOf [1]

···

Jody Garnett

On Tue, Jun 17, 2014 at 7:14 PM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Tue, Jun 17, 2014 at 11:03 AM, Jody Garnett <jody.garnett@anonymised.com> wrote:

I notice that the IsEqualsToImpl does make allowances for NaN:

return (fp1 == fp2) || (Double.isNaN(fp1) && Double.isNaN(fp2));

See https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/IsEqualsToImpl.java#L126

However I cannot see any test case showing how to make Double.NaN in NumericConverterFactoryTest (which is responsible for turning strings into numbers if required).

Sounds like you may have a bug report to make, for now try using an else rule to render anything that falls through the cracks.

Another, maybe more explicit way to handle this would be to add a filter function
that allows to check if a number is a NaN among the math functions:
http://docs.geoserver.org/stable/en/user/filter/function_reference.html#math-functions

(e.g., isNaN(myProperty))

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 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