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 <[email protected]> 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 > > > >
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
