UCDavisLibrary/ava

Handling dates in the GeoJSON files with QGIS

Closed this issue · 1 comments

Perhaps you're already aware of this but it's something I learned today and thought I'd share.

When adding the GeoJSON files to QGIS, either by the 'Add Vector Layer...' menu option or drag-and-drop, the default behavior of GDAL GeoJSON driver used by QGIS is to convert date-like strings to actual date types. This can be changed using an environment variable so that these property fields are treated as strings.

Simply go to Settings > Options > System and scroll down to the Environment section. Then add the variable OGR_GEOJSON_DATE_AS_STRING and set its value to YES. A restart is required.

Now when you add a GeoJSON file the dates will remain strings.

You can read more about the GeoJSON driver here.

Instructions for adding environmental variables are here.

Thanks, Kurtis! I've noticed that QGIS does strange things with the dates sometimes, but haven't had a chance to look into it. I think we should add this information to our documentation about how to contribute data. @erklopez can you work this information into the documentation (ask me questions) and @alisonsnwong you probably want to make these changes to your settings. Work with Sebastian to figure out how to work this into the docs.