Modeling in QGIS

Sep 9, 2020 | Forestry, process, Python, QGIS

I should model more….but I don’t. You’re welcome.

Anyway – the last few weeks I’ve been boring you with tales of topology and now I’m going to bore you with tales of building a model. One of my longest running jobs has been in Forestry and that’s pretty much a set of repeatable processes. With the current lockdown I’ve been experimenting with client data and how to speed up some of what I’ve been doing.

QGIS has a modeler. In ArcGIS, Modelbuilder was probably a favorite because I’m always doing repeatable processes. Granted I’ve offloaded a ton of things to PostGIS BUT – wouldn’t if be cool if…..

The Forestry guys get a new property to look at and I usually do something clumsy to get it into QGIS. If it’s an inventory they go and walk it. They usually walk it at a certain interval so they call me and I:

  • Create a Grid using the Regular Points processing tool.
  • Manually Delete the points that fall too far outside the boundary
  • Name the points

This takes anywhere from 5 minutes to 15 minutes depending on the property and the how well we feel the boundary fits the ground. A simple model would look like this:

With the QGIS Processing Modeler you have to set up an Input before you can do anything. So my input will be a vector layer. I will drag the Regular Points Algorithm in and give it an output. If I double click Regular points I need an extent to draw the points. I’m going to set that to a model input. I give it a name and you can see how everything is starting to connect. I also give it some spacing which is 264 feet (which is 4 chains):

Not bad but not great:

but I need to clip it to the boundary……and assuming the boundary is wrong I probably need to clip include some points outside the boundary. I also don’t want to open the model every time and change the spacing. Soooooooo…..Lets get the the “Poof” Magic part:

What did I do?

  • Buffer the input property
  • Create a grid based on this buffered polygon
  • Extract the points from the buffered area
  • Create a new layer

That’s almost perfect. So 5 minutes down to this. Of course there are things I need to change like “what if they want an irregular cruise” that might be a 4×3 or a 5×3. I haven’t quite figured out numbering the points but I”m assuming I’ll stumble into it it shortly.

I haven’t used the modeler in quite a while but with some extra time I’m going to shrink some of my processes to as “quick as possible”.  Probably play around with Python some but I don’t really have to – this works for what I need to do with some small adjustments.

 

 

 

 

 

You may also like

QGIS Model Designer Class – October 10th 2023

QGIS Model Designer Class – October 10th 2023

When I hit the halfway mark it's time to announce - October 10th from 12 to 4 EST. Class: Model Designer Price: $100 EventBrite Virtual (Zoom) Which I think the original post was just a few days back but the class is mostly fleshed out. I've been working on it off and...

QGIS Tips and Tricks – September 20th 2023

QGIS Tips and Tricks – September 20th 2023

I'm doing this one again before the FOSS4GNA conference URL: EventBrite Location: Virtual Cost: $100 The last time I did this it was pretty fun. First workshop/training class I had that almost sold out in forever. I cover 16 things with QGIS that you may not know it...

Class: Model Designer

Class: Model Designer

I keep typing Model Builder. Old habits die hard. In my continuing efforts to deconstruct whatever training I was doing - I'm now into "Part 2" which is a model designer class. Way back in the day when I cared more for the ESRI stuff, I had written a model builder...