QGIS Fun: Geometry by Expressions

Jun 6, 2022 | GIS

One question last week: “Why don’t my buffers come out right in EPSG:4326”. That launched into an explanation starting off with “Well….the Earth is round…”. We ended up discussing the buffer tool and “surprise” you can’t easily buffer in EPSG:4326. You really need to learn about your local projections.

Of course I am wondering “Can you buffer in EPSG:4326 in QGIS?” I can do about everything else. Lets say you have points to buffer and they are WGS84, your buffer tool will complain about your data being in degrees (but it will run):

Notice the orange exclamation point next to degrees

If I were in a database (postgis) I’d use st_transform and shove my data temporarily into a local coordinate system and be happy…..but I’m in a desktop piece of software………..but – if you’ve worked with the field calculator any amount of time you’ve got a transform function that allows you to reproject data when using an expression. I also have a buffer function. I can also interact with the geometry of the layer.

Everything is in EPSG:4326

QGIS now comes with a processing tool called “geometry by expression” that will allow me to use functions from the field calculator to work with geometry.

What is happening: I’m telling QGIS I want to buffer these points that are in EPSG:4326 10,000 Feet. Before I buffer them please shove them into EPSG:2274 so the 10,000 feet makes sense to me.

All that is left is to take my new layer and redefine it to 2274 – because I’m sneaking around QGIS’s nifty projection tools to create a layer with 2274 coordinates in a layer that thinks it should be in 4326. Confusing? A little – BUT – it’s possible. I could set this up in a model if I was going to do this constantly.

What did I tell the client? Reproject your data into a local projected coordinate system. What did I do – probably something I shouldn’t have BUT it shows how flexible QGIS has gotten in the last bit.

Hail Halloween

You may also like

Conda and QGIS Part 2

Conda and QGIS Part 2

Coming back from Yellowstone has left me slightly adrift. I missed a meeting yesterday as I keep forgetting to add things to my calendar. So the last time I mentioned Conda was like 2018 and the whole point to the Article was "I can now have two versions of QGIS...

MAGIP and TNGIC in 2024

MAGIP and TNGIC in 2024

I just came off two conferences with one being in Montana and one being in Tennessee. Both Geo related. It was my first time attending the MAGIP conference. Not that you need a long overly drawn out review of both - here are some of the highlights: TNGIC was fun. It...

QGIS and LIDAR and Forestry Part 2

At the TNGIC conference I did a workshop on LIDAR and QGIS. I was completely blasted out by ESRI's Avenue for the Web class but I had a few souls come in and take a look at it. I finished it off with "I don't use LIDAR that much". Well.....I'm finally using it. It...