GIS4WRF / gis4wrf

QGIS toolkit 🧰 for pre- and post-processing 🔨, visualizing 🔍, and running simulations 💻 in the Weather Research and Forecasting (WRF) model 🌀
https://gis4wrf.github.io
MIT License
159 stars 36 forks source link

SetProjection error for QGIS 3.10 #157

Closed letmaik closed 4 years ago

letmaik commented 4 years ago

(Originally reported in https://github.com/GIS4WRF/gis4wrf/issues/149#issuecomment-555757157.)

 Traceback (most recent call last):
  File "C:/Users/.../AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\widget_domains.py", line 555, in on_change_any_field
    self.draw_bbox_and_grids(zoom_out)
  File "C:/Users/.../AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\widget_domains.py", line 560, in draw_bbox_and_grids
    update_domain_grid_layers(project)
  File "C:/Users/.../AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\geo.py", line 87, in update_domain_grid_layers
    vrts = gis4wrf.core.convert_project_to_gdal_checkerboards(project)
  File "C:/Users/.../AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\core\transforms\project_to_gdal_checkerboards.py", line 29, in convert_project_to_gdal_checkerboards
    vrt_ds.SetProjection(project.projection.proj4)
  File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\site-packages\osgeo\gdal.py", line 1978, in SetProjection
    return _gdal.Dataset_SetProjection(self, *args)
RuntimeError: missing [

QGIS switched to GDAL 3 on Windows which contains a bug introduced while trying to maintain backwards compatibility. Instead of waiting for an upstream fix we are switching to the new convention of using WKT instead of proj4 as argument for gdal.Dataset's SetProjection.

letmaik commented 4 years ago

Fixed in https://github.com/GIS4WRF/gis4wrf/commit/5a4fc5a2e8a51d8c08540d6daae4fdeaaeafbcf6.