• Skip to primary navigation
  • Skip to main content

North River Geographic Systems Inc

Spatial Problem Solving

  • Home
  • About NRGS
  • Blog
  • Resources
    • Guides for using TN Data with QGIS
    • QGIS Resources
    • Tutorials
  • Services
    • Support Services
    • Tennessee NG911 Address Server
    • Training
    • Forestry Database Services
    • Conservation GIS
    • Data Analysis
  • Portfolio
  • Show Search
Hide Search

QGIS

Modeling in QGIS

rjhale · Sep 9, 2020 ·

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.

 

 

 

 

 

Topology: QGIS Geometry Checker and other tools

rjhale · Aug 25, 2020 ·

So lets dive more into “I need to fix my data”. In this case I have two layers – one is polygon and one is linestring.The polygon layer has overlaps and gaps. The linestring layer has dangles and is not intersected correctly causing more dangles. We looked at the polygon in the last post….and that’s what we will start with….and we have 208 errors which are gaps. The errors are the red lines you see along the borders.

So how am I going to fix this? Well I can always zoom to each error and manually fix it. It’s a slow go but At least I know what’s happening. If I think back to the ESRI world it seems their topology tool automatically fixes errors. Well – automatically with some intervention but it’s faster than manual.

Which brings us to this tool called Geometry Checker. It’s a plugin but it’s part of QGIS Core so you have it when you install QGIS. The goal is to clean up errors and it also has the added bonus to run some checks on your data.

Geometry Checker lets me look at some additional things like duplicate nodes. A Check for gaps. A Check for self intersections. A Check for smaller sliver polygons. It will also check to see that the layer you are working with follows the boundaries of a second layer. So do I need to check that this layer fits with the county? I probably should. So I’m going to check for polygons smaller than 1 square mile. Holes. Overlaps smaller than 1 square mile. Gaps bigger than 10 square miles. Which at this point there is no method to my madness – more just testing things to see what comes up.

You have 2 options at the end of this. One is to edit the layers “in place” which means the originals get changed. The other option is geopackage. As all my data is currently in postgis and I hate the idea of “edit in place” – I’m going to a geopackage and fix my data and then shove it back into the database.

When geometry checker is run a new geopackage is created. I am prompted with a list of errors I can work my way through and click a button to automatically fix the problem. I also have a setting for “error resolution settings” which will let me set some defaults like “merge the sliver polygons into the largest shared edge”. Overall it’s pretty awesome. It appears I can even fix more than one error at a time. I didn’t have much luck doing that BUT – I’m happy with one at a time in most cases.

What about the roads?

I have a road layer with roads that aren’t properly intersected. The Topology Checker works great and I can find them all…..so the Geometry Checker……

If you look at the Geometry checker I can check line strings for length, dangles, self intersection and a few other things. What I don’t get is a way to fix dangles like I have pictured above. Which sorta brings me to “I need a way to snap and break lines at intersections easily”. I can manually do it – but if I have a bad road layer (water lines, linear anything) that can be a pain to walk through.

but……there’s always a but…..

There are 2 tools in 3.14 (maybe earlier but that’s what I’m using) called Snap and Split Lines with Lines. So I’m going to run a Snap Geometries to Layer and then a Split Lines with Lines against the snapped layer and my Dangle issue almost goes away. Roads are always going to have dangling nodes – lets just not have them in the middle of the road. No i go back to Geometry Checker and look for duplicate nodes and other things.

So I have some tools to fix my data. Here would be my pros and cons:

Pros:

  • You can fix your data. Be it a shapefile, geopackage, postgis table, etc – the tools work. It’s a lot of tools also – if you’re coming from the ArcGIS world where you have to have a licensing level to run topology – you don’t have that problem anymore. You don’t have a table/data layer called topology – but you have a lot of tools to clean up your data and make it topologically correct.
  • New tools are coming constantly. I had a game plan for writing this article and discovered Snap and Break Lines with Lines. So if it seems like I shoved that in at the last minute (I did).

Cons:

  • You’ll notice back in the article you’ll notice I didn’t really give numbers on problems found. The Topology Checker would notice 208 gaps in my data and Geometry Checker would find 384. They are two different tools that (to me) serve two different purposes. So one might report more. One might report less. I would use both as a running check on my data and I might use topology checker throughout the day and geometry checker at the end of the day.
  • It’s not really a con – but when you’re fixing your data you may pull that data out of the original table (as I did) to fix it and then push your fixed data back into the database. Maybe I make a new table. I’m not sure on workflow yet so maybe this comes toward the end of the project.

One final word on Geopackage…..

One thing I have sort of taken for granted is geopackage. I say geopackage a lot. When I teach a class I yell geopackage. It wasn’t until I wrote this that I noticed everything is dumping back to geopackage. Some GRASS tools sometimes went back to shapefile in previous versions. It seems like there were a few tools that would in QGIS that wanted to go back to shape – it’s all Geopackage now. It’s nice.

—BUT—

Maybe I don’t want this much work fixing my data. I have geometry checker….and I have some tools from the processing toolbox……what if I wanted one tool to run my topology checks BECAUSE I’m really wanting to network these roads together…..what could that tool be………..those tools be…….

 

 

 

 

 

 

 

 

 

QGIS: Revisiting Topology

rjhale · Aug 20, 2020 ·

When you’re writing a blog two things tend to happen:

  • You rehash old topics that you covered 4 or 5 years ago. Usually that’s fine because something has changed enough you can cover it again and not sound repetitive.
  • You get to the point where “I really don’t want to talk about anything”.

I’ve been stuck in between the 2 for the last bit. After a small break from the TN 911 address project that is getting some more attention. The biggest bit of activity is on “Well how do I make sure the data isn’t screwed up….”

We’ve had to fix some data as of late – nothing terrible but it’s brought up a lot of questions on my end. One question has been “How do I make sure the data stays in good shape vs mistakes slowly propagating out”. Which then led to questions on topology and workflow. Some problems are topological and some are going to be attribution….some cover both…..

So I decided to rehash an old subject of topology that I’ve touched on a few times. I’m starting back at square one because maybe some of you know and maybe some don’t – but I’m starting on a workflow for the TN 911 Server so it gives me a chance to talk a little. Did you know you can check the topology of your data in QGIS?

Back when I first wrote about this….7 years ago…..this was a new feature for QGIS. Kind of a big deal for me because I come from a data background and I always like tools to help fix data. The topology checker isn’t there to fix bad data – it is there to point out bad data. It’s now a core plugin so you have to activate it but once you do you’ll get one added icon and one new panel to your QGIS Display.

For fun I’m going to build a rule that says the ESN layer (the black polygons) can’t have gaps. So when I run the tool it will highlight the problems:

What happened? More than likely a boundary was moved and the adjoining boundary didn’t move. Gaps were created. In some cases overlaps. Sometimes duplicate polygons.

It will walk me to each error and give me the chance to fix it. What? You mean it won’t fix it for me? Yes and No but that’s coming next. So you can sort of quickly get a visual on what is and isn’t wrong with your data. You can check lines and points also. You can also check to see if points are covered by polygons or points are at the end of lines. If you look at the help you’ll see an entire list of things it can check.

So welcome to “one way to check your data”. Next up – One of several ways to fix your data which I hope eventually leads me into this PGRouting  bit of excitement I’ve gotten myself into. Which if you start looking at the next few blog posts you’re going to say “Well it looks like you’re trying to do routing the in the database but you need to clean the data up first”.

 

QGIS Processing: History

rjhale · Jul 30, 2020 ·

If you’re anything like me (hopefully you aren’t) you’ll do something and immediately wished you hadn’t closed the processing window. Clip, simplify, select by location……

So in this case I had a call about contouring a Digital Elevation Model. Contours are easy. I ran them at 10…or maybe 20.

QGIS and DEM

I decided to clip them with the county boundary since the DEM extends outside of the county into the neighboring counties and states.

QGIS and Clipped DEM

So the question is now “WHAT DID YOU DO”. You get up. You come back. Cat jumps in your lap. Your Mom calls. QGIS keeps a history of your processing commands. If you look at the processing toolbox you’ll see a small clock.

Click it and another windows opens

Here is the cool thing. You click any of the commands and you’ll be taken back to your original QGIS Processing menu. So if I can contours and don’t like them at 20 foot intervals? Go back and check the history, double click,  and change it to 10 and run it again. You like python? You have what you need to know and you can run that from the python console. I made one small change and dumped it to a shape this time vs a memory layer:

So if you do forget a tool setting in the processing tools after you closed it – just run it again by looking at your history for the processing toolbox.

 

QGIS North America Meeting 2020

rjhale · Jun 5, 2020 ·

The QGIS US Users Group & partners in North America are proud to announce the QGIS North America 2020 virtual conference to be held on Friday, July 17, 2020 (and Friday, July 24th if needed). We offer this meeting as a way to share our ideas and skills when so many in-person meetings cannot safely happen. We recognize that while we are all separated, we have the opportunity to include people in a greater diversity in locations and economic situations since travel and registration costs are not necessary. We invite participation from all over the globe, but presentation times will focus on the North American audience.

The cost to attend will be free, and we would like to suggest attendees make a donation to support QGIS at https://qgis.org/en/site/getinvolved/donations.html

Call for Participation

The organizers of the QGIS North America 2020 virtual conference would like to solicit proposals for participation in this conference to be held online on Friday, July 17th (and potentially Friday, July 24th, with sufficient interest) in the form of talks, workshops, birds-of-a-feather networking sessions, and ideas for other session. Sessions can focus on any aspect of QGIS and we particularly encourage talks about applications of the software, software and plugin development, and discussions of transitioning to using QGIS software from other tools. Proposals for sessions should be submitted online via our Google Form: https://docs.google.com/forms/d/e/1FAIpQLScXVbO58aMZMmHo1mT5QEpF7uPki79e8PCyRJ9tBna_2IcAvw/viewform?usp=sf_link

Proposals for talks, birds-of-a-feather networking sessions, and ideas for other session require

  • Contact information for the presenter
  • Title
  • Description or abstract

Proposals for workshops requires

  • Contact information for the presenter
  • Title
  • Description or abstract
  • Length (in hours) of the workshop
  • Software requirements
  • A list of people who can potentially act as helpers (does not need to be finalized at the time of submission)

The deadline for submission is Friday, June 12, 2020.

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Interim pages omitted …
  • Go to page 40
  • Go to Next Page »

Contact

  • (423) 653-3611
  • info@northrivergeographic.com

Copyright © 2021 · Monochrome Pro on Genesis Framework · WordPress · Log in

  • Home
  • About NRGS
  • Blog
  • Resources
  • Services
  • Portfolio