-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGIS can't create conformant geopackage files with UTC "Z" timestamps #57262
Comments
One hack to working with UTC data is to set your Timezone environment variable to UTC (TZ=UTC) before starting QGIS and then QGIS won't display in local time.
Writing data with UTC timezones still seems awkward. For Geopackage files, it seems like QGIS should always write it with the standard yyyy-mm-ddTHH:MM:SSZ format. Which would make sense if TZ=UTC, but might have problems if TZ is not UTC--it needs something more to know if it should translate what seems to be a naive yyyy-mm-ddTHH:MM:SS timestamp from local time to UTC. https://gis.stackexchange.com/questions/316882/valid-datetime-in-geopackage suggests using the validate_gpkg.py script: If you File/create/geopackage, create a point geometry layer, add a datetime field, create, and then edit add a points and select a date on the default calendar form: ![]() ... and then save the file, and run the OSGEO validator on the resultant file with the option that actually checks the table data, you get this sort of error:
Looking at https://stackoverflow.com/a/4030812/1653571 it looks like actually assigning any timezone in Qt requires an extra step after parsing a string, such as https://github.com/search?q=repo%3Aqgis%2FQGIS%20setTimeSpec&type=code |
…when format string includes a Z Fixes qgis#57262
…UTC for GeoPackage Fixes qgis#57262
…UTC for GeoPackage Fixes qgis#57262
…when format string includes a Z Fixes #57262
…UTC for GeoPackage Fixes #57262
…UTC for GeoPackage Fixes qgis#57262
…UTC for GeoPackage Fixes #57262
…UTC for GeoPackage Fixes #57262
…UTC for GeoPackage Fixes #57262
What is the bug or the crash?
QGIS appears to filters the timezone information off of geojson and geopackage data and writes geopackage files with non-conformant timezone naive timestamps.
Steps to reproduce the issue
Follow along with https://gis.stackexchange.com/questions/480462/qgis-create-layers-with-datetime-with-utc-data
yyyy-MM-ddTHH:mm:ssZ
** Display Format:
yyyy-MM-ddTHH:mm:ssZ
** Overwrite Field Format:
yyyy-MM-ddTHH:mm:ssZ
** Default
format_date(datetime_from_epoch(epoch(now())+3600000*4),'yyyy-MM-ddTHH:mm:ssZ')
2024-04-27T02:33:39.000
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Active Python plugins
FreehandRasterGeoreferencer
0.8.3
quick_map_services
0.19.34
MagneticDeclination
2.4.4
DEMto3D
3.51
LAStools
2.1.0
GeoCoding
2.19
latlontools
3.6.20
processing
2.12.99
grassprovider
2.12.99
db_manager
0.1.20
MetaSearch
0.3.6
Supported QGIS version
New profile
Additional context
Per https://www.geopackage.org/spec/#table_column_data_types a conformant gpkg DateTime should be:
If QGIS is writing gpkg files, it should meet the standard. (I also think that if QGIS is reading non-standard .gpkg files, it should assume UTC.)
Some of my experiments (with screenshots) in trying to create gpkg file with UTC timestamps are shown on:
https://gis.stackexchange.com/questions/480462/qgis-create-layers-with-datetime-with-utc-data
I tried to create a new QGIS profile, but failed. The "New Profile" button didn't seem to exist:
![image](https://private-user-images.githubusercontent.com/2236516/326150000-d74e299d-82fa-4170-93ec-4df31e20dc30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTM2NzUsIm5iZiI6MTczOTQxMzM3NSwicGF0aCI6Ii8yMjM2NTE2LzMyNjE1MDAwMC1kNzRlMjk5ZC04MmZhLTQxNzAtOTNlYy00ZGYzMWUyMGRjMzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMDIyMjU1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODk3MjM1ZjFjODI0NGIyODZhNDEzNWYwMzIxMjYwZTBmNzhlYjMwMjYxMGIyYWZjYjQ5MDY0MTc5NGU4Y2Q1ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.bLUljk_267BuytBZ8I9Rf6C10hWhK51PCnlO9ZQb2Cg)
The text was updated successfully, but these errors were encountered: