[QGIS-Developer] Temporal ranges, default to 'include' both beginning and end?

Richard Duivenvoorde rdmailings at duif.net
Wed Aug 26 08:54:23 PDT 2020


Hi Devs,

I want to talk about how the 'filter'-range is calculated for data.

I'm working with 'time based model output' in which for every hour a value is calculated (via some math model).

So it is 'hourly' data, which you can either see as:

id    start     data
1     10:00     10
2     11:00     13
3     12:00     11
etc

or

id    start     end     data
1     10:00     11:00   10
2     11:00     12:00   13
3     12:00     13:00   11

Attached a 6 points dataset which should load in QGIS via CSV-loader as a dataset with 2 datetime fields and 6 features

In the Anita's timemanager using a timeframe of 1 hour you would see 1 point per frame.
With current new TimeController (both for 'Single Field with dt' and 'Separate Fields for Start and End') will show MORE then one point (using a duration/timeframe of 1 hour).

Searching in the code:
https://github.com/qgis/QGIS/blob/master/src/core/qgsrange.h#L228-L238
it looks like both limits are taken into account by default.
Which in my case does not reflect my intention...

So I am not sure what a good default is.
In most ranges (for example in style rules, the starting limit/border is taken into account, and the upper limit is NOT)
if I would do a PR in which for example the default is like that:
 QgsTemporalRange( const T &begin, const T &end, bool includeBeginning = true, bool includeEnd = false );
But I am not sure if this would break things.

I am aware that (for example in your code) you can SET these params, but in my experience (try the data) the are both included.
Mmm,
https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorlayertemporalproperties.cpp#L427-L448
shows that (at least for accumulated features) it should work like this...

Please test with attached mini dataset, you will see several dots at once.

Is this a bug, or do I make a mistake somewhere?

Regards,

Richard Duivenvoorde

PS 
I'm currently trying to 'registre' a layer programmatically as a temporal layer, and then want to start the control in a python plugin.
I could not find example code, so I am heavily looking at
https://github.com/qgis/QGIS/blob/master/src/gui/qgsvectorlayertemporalpropertieswidget.cpp#L101
but if somebody knows a better example, please let me know






-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6dots.csv
Type: text/csv
Size: 527 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200826/d0b46ba7/attachment.csv>


More information about the QGIS-Developer mailing list