Re: [Geotools-devel] WMS Date filters not working with MongoDB

2015-07-27 Thread Stefano Costa
Hi Nathan,

Il giorno ven, 24/07/2015 alle 20.50 +, Reese, Nathan ha scritto:
> Wow, That is an amazingly fast turn around time. Thanks for the patch - I am 
> now able to filter by Date with MongoDB!

Thanks for confirming the patch works! If I don't receive any negative
feedback on it within today, I'll merge it into master.


> In the file FilterToMongo.java, line 261, did you mean to create 
> leftValueType with getValueType(right).
> 
> Class leftValueType = getValueType(right), rightValueType = 
> getValueType(left); 


Yes, I did mean it, but I agree at first face the naming is a bit
confusing: can you suggest a better one?

The reasoning behind it is that the type of one expression is inferred
from the type of the expression it is compared to: this is mainly useful
to determine the actual type of a literal expression, when it can't be
desumed from the literal itself.
For example, in the case of a WMS with a CQL filter on a Date attribute,
the CQL parser gives us a literal expression that evaluates to a String,
but we need to parse it into a java.util.Date object to properly encode
the filter for the mongodb backend. How can we know that the String
should actually be parsed into a Date? From the type of the expression
it is compared to.

That's where rightValueType = getValueType(left) comes from. Hope this
clarifies it a bit.


-- 

Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Dott. Stefano Costa
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

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




--
___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel


Re: [Geotools-devel] WMS Date filters not working with MongoDB

2015-07-24 Thread Reese, Nathan
Wow, That is an amazingly fast turn around time. Thanks for the patch - I am 
now able to filter by Date with MongoDB!

In the file FilterToMongo.java, line 261, did you mean to create leftValueType 
with getValueType(right).

Class leftValueType = getValueType(right), rightValueType = 
getValueType(left); 

It seams like this line should be
Class leftValueType = getValueType(left), rightValueType = 
getValueType(right);

Nathan 



From: stefano.costa [stefano.co...@geo-solutions.it]
Sent: Friday, July 24, 2015 8:25 AM
To: andrea.a...@geo-solutions.it
Cc: Reese, Nathan; geotools-devel@lists.sourceforge.net
Subject: Re: [Geotools-devel] WMS Date filters not working with MongoDB

Hi,
here is a pull request that should fix the issue:
https://github.com/geotools/geotools/pull/919


Reviews are welcome ;-)


Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Dott. Stefano Costa
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

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


Da: "Andrea Aime" andrea.a...@geo-solutions.it
A: "Reese, Nathan" nre...@integrity-apps.com
Cc: "geotools-devel@lists.sourceforge.net" geotools-devel@lists.sourceforge.net
Data: Fri, 24 Jul 2015 08:26:58 +0200
Oggetto: Re: [Geotools-devel] WMS Date filters not working with MongoDB

> On Fri, Jul 24, 2015 at 12:28 AM, Reese, Nathan 
> mailto:nre...@integrity-apps.com>> wrote:
> The query below is what the query generated by geoserver should look like
> {
>   "date" : {
> "$gt" : ISODate("2015-07-01T00:00:00Z")
>   }
> }

> How can I get the date query to be typed as Date instead of String?

> I believe you'll have to modify this method, checking if the

> https://github.com/geotools/geotools/blob/master/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongo.java#L530<https://github.com/geotools/geotools/blob/master/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongo.java#L530>

> There is a catch though, if you have the filter expressed in CQL, the date 
> will be parsed as a java.util.Date and
> you can just do a instanceof in that encodeLiteral method, if instead it 
> comes from a OGC filter (xml form) it will be parsed as a String,
> and the encoder is supposed to cast it to the right type, like FilterToSQL 
> does, by checking what data
> type the attribute it's compared to is:
> https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/FilterToSQL.java#L712<https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/FilterToSQL.java#L712>

> Cheers
> Andrea

> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V<http://goo.gl/it488V> for more information.
> ==

> Ing. Andrea Aime
> @geowolf
> Technical Lead

>

Re: [Geotools-devel] WMS Date filters not working with MongoDB

2015-07-24 Thread stefano.costa
Hi,here is a pull request that should fix the issue:
https://github.com/geotools/geotools/pull/919




Reviews are welcome ;-)


Best regards,
Stefano Costa
 
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Dott. Stefano Costa
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
 
---
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.


Da: "Andrea Aime" andrea.a...@geo-solutions.it
A: "Reese, Nathan" nre...@integrity-apps.com
Cc: "geotools-devel@lists.sourceforge.net" geotools-devel@lists.sourceforge.net
Data: Fri, 24 Jul 2015 08:26:58 +0200
Oggetto: Re: [Geotools-devel] WMS Date filters not working with MongoDB




> On Fri, Jul 24, 2015 at 12:28 AM, Reese, Nathan  
> wrote:
> The query below is what the query generated by geoserver should look like
> 
{
> 
  "date" : {
> 
    "$gt" : ISODate("2015-07-01T00:00:00Z")
> 
  }
> 
}



> How can I get the date query to be typed as Date instead of String?


> I believe you'll have to modify this method, checking if the 


> https://github.com/geotools/geotools/blob/master/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongo.java#L530



> There is a catch though, if you have the filter expressed in CQL, the date 
> will be parsed as a java.util.Date and
> you can just do a instanceof in that encodeLiteral method, if instead it 
> comes from a OGC filter (xml form) it will be parsed as a String,
> and the encoder is supposed to cast it to the right type, like FilterToSQL 
> does, by checking what data
> type the attribute it's compared to is:
> https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/FilterToSQL.java#L712



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


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

Re: [Geotools-devel] WMS Date filters not working with MongoDB

2015-07-24 Thread stefano.costa
Hi Nathan,looks like a bug, I've opened a JIRA ticket for it: 
https://osgeo-org.atlassian.net/browse/GEOT-5172.


I'll have a look at it ASAP.

Best regards,
Stefano Costa
 
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Dott. Stefano Costa
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
 
---
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.


Da: "Reese, Nathan" nre...@integrity-apps.com
A: "geotools-devel@lists.sourceforge.net" geotools-devel@lists.sourceforge.net
Cc: 
Data: Thu, 23 Jul 2015 22:28:06 +
Oggetto: [Geotools-devel] WMS Date filters not working with MongoDB


> I am creating a date filter like so
> 
> 
>   
> date
>   
>   
> -MM-dd
> 2015-07-01
>   
> 
> 
> The query string getting sent to MongoDB from geoserver looks like
> {
>   "date" : {
> "$gt" : "Wed Jul 01 00:00:00 UTC 2015"
>   }
> }
> 
> But the query returns nothing. That is because the date is getting passed 
> into Mongo as a string instead of a Date.
> 
> The query below is what the query generated by geoserver should look like
> {
>   "date" : {
> "$gt" : ISODate("2015-07-01T00:00:00Z")
>   }
> }
> 
> How can I get the date query to be typed as Date instead of String?
> 
> Thanks,
> 
> Nathan
> 
> --
> ___
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel--
___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel


Re: [Geotools-devel] WMS Date filters not working with MongoDB

2015-07-23 Thread Andrea Aime
On Fri, Jul 24, 2015 at 12:28 AM, Reese, Nathan 
wrote:

> The query below is what the query generated by geoserver should look like
> {
>   "date" : {
> "$gt" : ISODate("2015-07-01T00:00:00Z")
>   }
> }
>
> How can I get the date query to be typed as Date instead of String?
>

I believe you'll have to modify this method, checking if the

https://github.com/geotools/geotools/blob/master/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongo.java#L530

There is a catch though, if you have the filter expressed in CQL, the date
will be parsed as a java.util.Date and
you can just do a instanceof in that encodeLiteral method, if instead it
comes from a OGC filter (xml form) it will be parsed as a String,
and the encoder is supposed to cast it to the right type, like FilterToSQL
does, by checking what data
type the attribute it's compared to is:
https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/FilterToSQL.java#L712

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

*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.

---
--
___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel


[Geotools-devel] WMS Date filters not working with MongoDB

2015-07-23 Thread Reese, Nathan
I am creating a date filter like so


  
date
  
  
-MM-dd
2015-07-01
  


The query string getting sent to MongoDB from geoserver looks like
{
  "date" : {
"$gt" : "Wed Jul 01 00:00:00 UTC 2015"
  }
}

But the query returns nothing. That is because the date is getting passed into 
Mongo as a string instead of a Date.

The query below is what the query generated by geoserver should look like
{
  "date" : {
"$gt" : ISODate("2015-07-01T00:00:00Z")
  }
}

How can I get the date query to be typed as Date instead of String?

Thanks,

Nathan

--
___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel