[QGIS-Developer] QGIS, DateTime and TimeZones

Richard Duivenvoorde rdmailings at duif.net
Sun Nov 8 23:24:35 PST 2020


On 11/9/20 12:46 AM, Nyall Dawson wrote:
> But more generally, I'd say you don't need any external library here.
> Basically the library is just doing a point in polygon lookup against
> the reference boundaries, and that's something which QGIS is already
> awesome at ;) I'd suggest you just:
> 1. find the format which gives smallest file size for the time zone boundaries
> 2. include this in your plugin
> 3. use native classes classes to read these boundaries and use
> QgsFeatureRequest to do the point in polygon lookups.

+1 !

Thanks Nyall, for making this clear (to me).

If we either create a new geopackage with timezones (geoms) in it and put it:
https://github.com/qgis/QGIS/tree/master/resources/data
OR add it to current world_map.gpkg, you can use the 'inbuilt:' uri to get to the data
(iface.addVectorLayer('inbuilt:/data/world_map.gpkg', 'Countries', 'ogr')) to (reverse) lookup timezones.

Then use Qt's Datetime to handle the actual date/time-stuff.

(What we do not tackle now is that QGIS itself does not handle this deep inside yet)

Regards,

Richard Duivenvoorde





More information about the QGIS-Developer mailing list