Im loading some layers from postgis using pyqgis in my standalone qgis app. For each layer i also load a style using:
I've setup 2 versions of styles in qgis desktop, one with and one without scale range visibility settings for the layer. The problem is, when i use the style with scale visibility (no matter if i set a really large range from 1:100 000 000 to 1:1) my features are not shown, not ever. If i use no style at all, or style without scale visibility settings, the layers are visible normaly.
I should add, styles work in QGIS desktop as expected.
What bothers me slightly is that when i print the current scale property of the map canvas in my app, the value has an insanely large value, for example 10e14 to begin with, even though the scale should be somewhere around 4000000 (1:4000000). What is even wirder is, this scale value (canvas.scale()) changes significantly when i pan (not zoom) the map.
Any ideas what is going on?
Because i thought the mapCanvas srid is not setup correctly and the scale would never fit into my scale range, I tried setting map canvas srid explicitly, did that on layers, stil no luck. I am using QGIS 2.8.1
UPDATE: It seems in any case i have to set the CRS explicitly
but it doesn't change anything. I just thought that layers will implicitly enforce my local CRS but they don't.