[QGIS-Developer] QGIS, DateTime and TimeZones

C Hamilton adenaculture at gmail.com
Mon Nov 9 06:48:56 PST 2020


This all sounds good to me. I am guessing that we will not be able to get
around a fairly large data set because of the need to keep the accuracy of
the boundaries. There is a project called Timezone Boundary Builder (
https://github.com/evansiroky/timezone-boundary-builder) that is a detailed
polygon of the time zones based on OSM data with one attribute which is the
time zone. When used in conjunction with the Time Zone Database (
https://www.iana.org/time-zones), it probably gives everything that is
needed. QGIS already includes pytz which is the Time Zone Database.

On Mon, Nov 9, 2020 at 2:24 AM Richard Duivenvoorde <rdmailings at duif.net>
wrote:

> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201109/a2a4ba7e/attachment.html>


More information about the QGIS-Developer mailing list