qgis2web icon indicating copy to clipboard operation
qgis2web copied to clipboard

Graduated polygon style with expression

Open philipjohnbarlow opened this issue 7 years ago • 4 comments

Single symbol style when creating a map with graduated polygon styling. I suspect this is probably because I am using an expression to convert numbers stored as text to real (numeric)?

philipjohnbarlow avatar Nov 14 '17 15:11 philipjohnbarlow

Can you upload project and layer? Only a small subset of expression functions have been written, but if it's not a spatial function, it could be easy to add in.

tomchadwin avatar Nov 14 '17 20:11 tomchadwin

qgis2web_graduatedexp.zip

There you go, it's probably fairly common for people to use an expression with data joined from a csv because it always joins as text/varchar. The expression is just "toreal("field")". I suppose you could just convert the column data type with the field calculator and avoid this issue.

philipjohnbarlow avatar Nov 15 '17 08:11 philipjohnbarlow

Ah, there's a another more fundamental issue. I don't think expressions in the "graduate on" field are supported yet. nor is toreal() as far as I can remember, but the first issue is more problematic.

Only way around this I can think of at the moment is to switch to a rule-based renderer, and move the toreal() call into the rule. I think that should work (if we add toreal()).

tomchadwin avatar Nov 15 '17 09:11 tomchadwin

Thanks Tom, I was making these maps for a colleague (though ultimately for our members) and decided to see how they would look as a web map. So it was purely by chance that I found out this didn't work. From what I can see the easiest work around is to just use the field calculator to create a new column (even a virtual one) with the figures stored as text converted to real and it works fine then.

philipjohnbarlow avatar Nov 15 '17 10:11 philipjohnbarlow