QGIS 2.6: Virtual Fields

Oct 30, 2014 | Open Source GIS, QGIS

Virtual Fields – huh?

So something else new in QGIS 2.6. In case you aren’t familiar with QGIS – you have a field calculator. It’s as the name implies – a place to calculate attribution and a chance to get technical with expressions if needed.You can calculate areas, do string manipulation, and release your inner math demon.

If I can walk you through an example of why this is cool and your brain can run with ideas. I have a polygon that I’m working on with my clients. They wish to know how big of an area the polygon covers. So I’m going to create a new field called vArea (just so I can remember it’s virtual).

Screenshot - 10302014 - 05:49:20 PM

Note I’m adding a field with a expression. In this case I’m getting the area in Acres (Area in square feet / 43560). I’ve got an area of 82.736 Acres. As is usual the polygon is wrong and I’ve got to adjust it. So with their help I’m now readjusting the boundary from:

Beginning Polygon

Beginning Polygon

Adjusted Boundaries

Adjusted Boundaries

and just for fun I reopen the attribute table and:

Screenshot - 10302014 - 05:55:40 PM

 

 

 

My vArea has changed to 99.983 Acres. The virtual field updated. For the record this was all done with a shapefile. The only time you see behavior like this is (in my opinion) when you deal with a database, or a carefully worked script/plugin/extension, or for those of us who have dealt with a file based geodatabase (those will keep up with area but not calculations).

Once I remove the layer from QGIS the field Vanishes. So far the field has stayed if the layer stays in the QGIS project (save close and reopen a project).

It’s impressive. It’s cool. It’s Free and Open Source from the hard working developers of QGIS.

 

 

You may also like

QGIS US – September 22nd 2026 EDT

QGIS US – September 22nd 2026 EDT

It's been a while since I've done a QGIS US meeting. Part of it was burnout and part I've been busy with work and life. So we're talking projections tomorrow. Proj is a bigger project than just QGIS - but it's nice to know how that project is moving along. Meeting...

QGIS Offline Help

QGIS Offline Help

Through a long series of events I found myself teaching QGIS in a classroom again. It's been a while. I used to just "hold" classes and sometime during the pandemic I jsut stopped. Occasionally I'll get a call for 3 or 4 people that want training but generally I've...

The online training website that I hardly talk about

The online training website that I hardly talk about

I had mentioned it some but it's probably been coming up on 6 months since I even mentioned training. Right before I decided to attempt to die in 2025 I had started building a training website at training.northrivergeographic.com. Basically it's my Intro to QGIS class...