inasafe/safe-geonode

Input hazard layer get silently overwritten by the output/calculated layer

vdeparday opened this issue · 1 comments

The culprit line is here: https://github.com/inasafe/safe-geonode/blob/master/safe_geonode/storage.py#L587

In the keyword file of the calculated layer, there are several keywords that contains the string "title" ( exposure_title, map_title, hazard_title) so the title ends up being whichever one of the keywords is last in the keyword file. Since hazard_title is last, then the layer gets overridden.

Potential fixes:
call storage.save_to_geonode with a title parameter
concatenate the titles in one new title string but the titles would need to get re-ordered to have first map_title and then the hazard and exposure

So I changed overwrite to False by default and thanks to this https://github.com/GeoNode/geonode/blob/master/geonode/layers/utils.py#L196-L199 now the layer is no longer overwritten, it is now the hazard layer concatenated with a count number. So the title of the output layer still need but this issue is closed. I will create a new one for the title issue.