boku-ilen / geodot-plugin

Godot plugin for loading geospatial data
GNU General Public License v3.0
108 stars 18 forks source link

Using `GeoRasterLayer.smooth_add_value_at_position()` requires to clean and rebuild overviews to show effect #74

Open MathiasBaumgartinger opened 1 year ago

MathiasBaumgartinger commented 1 year ago

The function (at least on a GPKG) will not show immediate effects in the landscapelab. QGIS showed the added values, but only on a specific zoom level. Rebuilding overviews is necessary:

  1. gdaladdo -clean GPKG:LL.gpkg:dhm
  2. gdaladdo -r nearest GPKG:LL.gpkg:dhm

The geopackage might not be flushed properly. It also weirdly adds a journal and wal file which summed up made almost half a gigabyte.

This would also explain another problematic behavior, which causes crashes when using the function multiple times on the same dataset.

kb173 commented 1 year ago

Can be done from code via BuildOverviews(): https://gdal.org/doxygen/classGDALDataset.html#aaaa6eccc928a80a94e9686cee64792c9

Since rebuilding overviews takes some time, it might be more sensible to clean overviews automatically in smooth_add_value_at_position and allow the user to rebuild them later with something like GeoRasterLayer.rebuild_overviews().