boku-ilen / geodot-plugin

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

Improve performance of GeoRasterLayer editing functions #72

Open kb173 opened 1 year ago

kb173 commented 1 year ago

GeoRasterLayer::smooth_add_value_at_position and GeoRasterLayer::overlay_image_at_position both work by repeatedly calling GeoRasterLayer::set_value_at_position. This produces a lot of single RasterIO calls, which is very inefficient. It would be better to write all data into the dataset at once. This means that we need to adapt RasterTileExtractor::write_into_dataset to take arbitrarily large arrays, and then construct these arrays in the GeoRasterLayer functions.

Perhaps we could re-use code more efficiently by making GeoRasterLayer::smooth_add_value_at_position call GeoRasterLayer::get_image and then GeoRasterLayer::overlay_image_at_position with the modified image.