QGIS processing: select by expression

QGIS processing: select by expression



QGIS 3.x mette a disposizione, tra gli strumenti di processing, molti algoritmi per la selezione di feature:

  1. Selezione per attributo;
  2. Seleziona per espressione;
  3. Seleziona per posizione;
  4. Seleziona casuale;
  5. Seleziona casuale con un sottoinsieme.

Strumenti di Processing

tra queste reputo straordinaria la Selezione per espressione (select by expression) in quanto è molto potente, didattico e mette a disposizione tutte le funzioni del calcolatore di campi; in questo blog post esploreremo alcune delle infinite possibilità di questo algoritmo.

Ecco la prima differenza tra la 2.18 e 3.x:


seleziona la provincia in cui ricade il tratto più lungo del fiume Arno

maximum(coalesce(length( intersection(geometry(get_feature( 'fiume_arno','nome','ARNO')), $geometry)),0)) 
length( intersection(geometry(get_feature( 'fiume_arno','nome','ARNO')), $geometry))

Seleziona il comune – per ogni provincia – attraversato dal tratto più lungo del fiume Arno

array_first( array_sort( array_filter( array_agg( length(intersection(geometry(get_feature( 'fiume_arno','nome','ARNO')), $geometry)), "cod_prov"), -- calcola lunghezza @element is not null -- esclude i valori NULL…

Ver o post original 66 mais palavras

Advanced Propensity to Cycle Tool training: write-up, materials, and next workshop

PCT blog

The first of two Propensity to Cycle Tool (PCT) Advanced Training Workshops took place last week in London, part of the Phase III of the project to inform investments in cycle networks and other interventions for sustainable transport. This post provides an outline of the contents of the workshop, plus links, ideas and sample code. The course was delivered by me (Robin, Lead Developer of the PCT) and my colleague Malcolm Morgan (who led on some of the big data processing and raster tile generation elements of the project). Warning: both of us are heavy R users, so the materials contained plenty of code (more on that soon)!

The good news for people who were unable to attend the first advanced workshop and cannot make the next course in Leeds on the 2nd August is that all the materials are freely available, following ‘open source’ approach in the PCT:…

Ver o post original 1.347 mais palavras

QGIS Tips – Custom feature forms with Python logic

Nathan Woodrow

Last week I found a nice little undocumented feature of QGIS. I plan on writing documentation, so it won’t stay that way for long but I thought I would post about it first and run though it step by step.

This post is going to be a follow up post based on what Tim Sutton did for the same subject back in 2009 at http://linfiniti.com/2009/11/creating-dynamic-forms-a-new-feature-headed-for-qgis-1-4/

For data entry one feature I really like in QGIS is the automatic feature edit forms with support for textboxs, dropdowns and all sorts of other cool Qt controls to make data entry a breeze.

However one thing that people might not be aware of is that you can have a custom forms for data entry. QGIS will take care of setting all the fields and then saving the values back to your layer.

This could be handy if you want to have say a…

Ver o post original 977 mais palavras

Design better forms in QGIS

Geouk - the ramblings of an 'ol fella'

Difficulty = if I can do it, you can (based on the: ‘can I do it scale’!)

I’ve been experimenting with dialogue box design just lately for two reasons:

  • I wanted a more intuitive box for the others in my team to be able to enter data based on a workflow rather than the standard straight down approach and to provide check and drop-down boxes for some of the fields.
  • the second reason was for the need to enter data quickly in just two fields, on a table that had loads of fields, the two fields would have been at the top and near the bottom respectively on a normal dialogue and so was a pain tabbing all the way down.

A little research (mainly reading Nathan Woodrow’s blog posts on the subject – don’t be put off by the Python stuff, use the link in his post to the…

Ver o post original 995 mais palavras