jkall / qgis-midvatten-plugin

Midvatten plugin for QGIS
25 stars 8 forks source link

label position in section plot #278

Closed jkall closed 5 years ago

jkall commented 6 years ago

Currently the labels are shown at level=0 when only water level is shown (i.e. stratigraphy checkbox inactivated in gui).

The labels should be placed within visible scale range (specifically the y-axis), either close to the plotted water level (with some offset), or at least close h_gs or h_toc.

HenrikSpa commented 5 years ago

Do you have a database and obsids-example for this? In the current code it should put the labels at the water level and when I tried it on two obsids it did print the obsid labels correctly. Maybe there's something in the water level series that causes the error.

jkall commented 5 years ago

I can not reproduce this repeatedly. But I think it is related to the following.

If deselecting "table with water level data" (i.e. select the first empty row in the dropdown list) while keeping some rows in the list with date_times and obsids to be plotted.

image

Python errors shows that sql queries are sent when there are rows in the list "date time f w lev..." but no related table is selected in the dropdown list:

Sql failed, see log message panel.
DB error!
SQL causing this error:SELECT level_masl FROM  WHERE obsid = '18019' AND date_time like '2018-01%'
            Msg:
            near "WHERE": syntax error

So, need some checks to verify there actually is a water level table selected before trying to plot water level data.

HenrikSpa commented 5 years ago

Fixed. If stratigraphy is not used, labels are now printed at waterlevel or at h_gs or at h_toc-h_tocags or at h_toc (whichever works first).