[Qgis-user] Issue with temporal query in a symbology rule

Neumann, Andreas a.neumann at carto.net
Wed Nov 18 02:35:24 PST 2015


 

Hi Jürgen, 

I created two expressions: 

startzeit <= now() AND endzeit >= now() 

vs 

to_datetime(format_date(startzeit,'yyyy-MM-ddTHH:mm:ss')) <= now() AND
to_datetime(format_date(endzeit,'yyyy-MM-ddTHH:mm:ss')) >= now() 

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

The first fails, the second works fine - with some unneccesary
conversion from DateTime to String and then back to DateTime. 

So there seems to be an issue with the interpretation of DateTime
objects in QGIS expressions. At least for PostgreSQL data sources. 

Andreas 

On 2015-11-18 11:17, Neumann, Andreas wrote: 

> Hi Jürgen, 
> 
> I can follow your examples - they work fine. 
> 
> My conclusion is that the expressions are fine - but there is an issue if the attribute data that comes from Postgis with a data type "timestamp without time zone". Maybe these attribute columns from Postgis aren't correctly evaluated as a DateTime data type? 
> 
> ------------------ 
> 
> I'll send you some sample data privately. 
> 
> Thanks, 
> 
> Andreas 
> 
> On 2015-11-17 21:29, Jürgen E. Fischer wrote: 
> Hi Andreas,
> 
> On Tue, 17. Nov 2015 at 19:24:20 +0100, Neumann, Andreas wrote: I know that it works well on PostgreSQL - but I am talking about
> symbology rules in QGIS. Can I use Postgis syntax in QGIS rules? The
> QGIS query builder doesn't list "BETWEEN" as an operator. 
> Oh, I completely missed that you were talking about an expression. Sorry.
> 
> But I cannot reproduce the problem with an expression either:
> 
> to_datetime('2015-11-17T21:24:18') <= to_datetime('2015-11-17T21:24:18') AND to_datetime('2015-11-17T21:24:18') >= to_datetime('2015-11-17T21:24:18')
> 
> produces 1 too.
> 
> Jürgen 
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user 

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20151118/5c5e80b8/attachment.html>


More information about the Qgis-user mailing list