Upcoming fun in QGIS 2.8: Define your own Python Functions

Feb 10, 2015 | GIS, Open Source GIS, Python

I wrestled with this blog post quite a bit. One of the spots I’ve fallen short in my GIS life has been programming. I’ve done the whole path of AML, Avenue, some dive into VB, mix in some shell scripting….then python. Toss all of that out now as history except for python. It takes me about a day to get back into python mode because it’s just a tool I use occasionally. I need to use it more – but another story for another time.

Anyone else ever type pythong?

Anyway – When ArcGIS 10 came out I started working my way through ArcPy. When QGIS 2.6 came out I decided to start working my way through plugins and the python console. My goal is to write a plugin. I’ve got an itch to scratch on a project and I think this is going to be my outlet.

I started playing with QGIS 2.8 and found something nifty in the field calculator and the expression editor: Functions. You can write your own in python. Of course no matter what I say at this point at best I’m only badly repeating what The Great Nathan has already written:

A new feature for QGIS 2.8 is a function editor for expressions. Being able to define your own custom functions has be possible for a while now, over a year, I even have a plugin (Expressions+) that adds some extra ones, however it wasn’t easy for new users and required you to create files that lived on python path while also editing the startup.py file for QGIS so that functions got registed at start up. Way too much effort for my liking.

Complete with Video From Nathan:

So as I always say – learn some python and that’s actually not a wasted thing to do. Of course as I look back I do wonder what is next “thing” I might need to learn.

…and as I always say – It’s nice to use qgis. If for nothing else because I can email the developers. I can say “HEY WHAT ABOUT…..” and they will respond back with “You’re insane” (no one has ever done that) or “Hey that’s a half decent idea that won’t wreck the project”.

Intro to QGIS class is now online!

You may also like

Advertising and the Great Tweet

Business. It's complicated. One of the more complicated things I've done has been advertising. How do you advertise a small GIS Consulting Shop? Ads on "The Internet"? Magazine? Direct Mailings? Word of mouth? The answer is "word of mouth". That and Conferences. That...

FOSS4G Nashville Updates

wiki: https://wiki.osgeo.org/wiki/20221201-Nashville-foss4g OK - Updates. When this conference first started a few years back it was a wild hope that I could start a community building event here in the Southeastern US. Every year I was always amazed that people...

FOSS4G Nashville Nov 30-Dec 2nd 2022

FOSS4G Nashville Nov 30-Dec 2nd 2022

It's happening. The big plan for the FOSS4G style meetings I've held around here has been "grow this beyond me". At the TN GIS conference this year I was approached by Two people from Vanderbilt and this now gets a little bit bigger and better. So we're headed to...