[Qgis-user] Help with cached join layer refresh using PyQGIS

2018-01-31 Thread Kory Roberts
For reasons I won't go too deeply into, unless requested, I regularly 
need to run a very short PyQGIS query/filter code on 2 Spatialite layers:


query = '"id_a" IN (47, 120)'
canvas = qgis.utils.iface.mapCanvas()
allLayers = canvas.layers()
for layer in allLayers:
    if layer.name() == 'Layer_A':
        layer.setSubsetString(query)
    elif layer.name() == 'Layer_B':
        layer.setSubsetString(query)

Layer_A contains a geometry field, Layer_B does not.  Layer_B is a view, 
which honestly is very slow to process.  I have these joined in QGIS: 
Layer Properties -> Joins.  For performance reasons, I have "Cache join 
layer in virtual memory" selected, otherwise editing is *unbearably 
slow* to the point that QGIS completely locks up for long periods of time.


The issue then, is that after I run the code subsequent times (changing 
for new queries), I have to go back into Layer Properties -> Joins -> 
specific join, click OK (without need to change any settings) to refresh 
the cache.


Probably a long way to this, but...  Is there a way in PyQGIS to refresh 
the cache for the join layer and just add that line in at the end of the 
already existing code?


Thanks.

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] QGIS 2.99/3 layer type management is a complete mess

2018-01-26 Thread Kory Roberts

I posted as feature request, but was closed quickly.

http://issues.qgis.org/issues/17966#change-86199

I'm hoping to further consideration here.

In short, layer type management in QGIS has now become a scattered mess.  
The program now handles so many file formats that the display and handling 
of those is just scattered and inconsistent.  Too many icons and top level 
menu choices!  Too confusing for new users.  Why aren't most of these 
defaulted to "off" since most users may only likely need selected ones?  
Forms in Data Source Manager aren't consistent (URL for GeoJSON is entered 
in a completely different dialog than URL for WMS, for example).  At the 
least, it seems like databases and URL souces could be lumped in common 
dialog entry forms.  But really, Add vector layer and Add raster layer 
should be the only top level choices, with specific formats, etc. selected 
later.



___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Debian/Ubuntu Install of 2.18 and 2.99 Together?

2017-08-30 Thread Kory Roberts
Is there a recommended way of concurrently installing both 2.18 and 2.99 on 
Debian/Ubuntu that isn't overly complicated (getting into and out of)?  I 
have the latest release of 2.18 installed using the repository 
http://qgis.org/ubuntugis.  I'd like to preview the upcoming version, but 
when I added the repository http://qgis.org/ubuntugis-nightly, it looked 
like the update manager was going to upgrade QGIS.  What I really wanted 
was to install them both.  Thanks.



___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] QGIS 2.16 Form View and Field Calculator Buggy?

2016-07-24 Thread Kory Roberts
I'm running into all kinds of seemingly buggy behaviors with the form 
view and field calculator on QGIS 2.16.  Here are some actions and results:


FORM VIEW
1) Start a fresh QGIS project.
2) Create a new point Shapefile layer.
3) Add a new field "test_num" as a decimal number and "text_txt" as text 
data.

4) Toggle edit mode and add a point.  Give id as "1", others as NULL.
5) Save layer edits.
6) Open attribute table in table view and enter some text in "text_txt".
7) Switch to form view.
 BUG 1?: "text_txt" displays NULL instead the text.  Clicking around 
and even saving does not seem to refresh the view.  The only thing that 
seems to work is to click off of the item in column preview and then 
select it again.

8) In form view, open field calculator.
9) Select update existing field and "text_num".
10) Enter a number in the expression space and click OK.
 BUG 2?: "text_num" displays no change.

FIELD CALCULATOR
11) Add another point to the canvas.
12) Save edits.
13) Open field calculator.
14) Enter "$x" in the expression space and check the output preview.
15) Select the other point.
16) Recheck the value for "$x"...It's the same as before.
 BUG 3?: This might be me misunderstanding how these variables work, 
but I thought $x and $y should change depending on the current feature 
selected or being edited?  In an actual work layer with many points, I 
keep getting the same values for $x and $y regardless of what I try.


Trying similar actions to bug hunt has resulted in at least 2 
freezes/crashes of QGIS along the way, too.


~Kory
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user