Selecting by Location

Feb 15, 2021 | Default

You would think after doing this for as long as I have I would “have an answer” for about everything. Last week found me going “well select by location and check…well…check….what do you want? Well pick intersects… no…within…no… cross…well……&*^%”

So I started a small journey of self discovery on “what does every check box do”. Surprisingly – I didn’t know what every checkbox did…and again – I’ve been doing this too long not to know. Yes I can read the help but…..

I pulled out all the counties that surround me and randomly generated 5000 points and buffered them. Then I just started clicking and walking through “why”. To be honest I never just create test data – and that was amazingly fast and made my life pretty simple.

So – here we go. I will select my county and crank up “Select by Location” in QGIS:

  • “Intersects” does exactly what you think it does. If the polygon “intersects” my county it is selected. I have 851 polygons touching my county.
  • “Are Within” does what I expected as I have 651 polygons within my county.
  • “Overlap” does what I want – I have 166 polygons that touch the county line. They don’t reside in any one county
  • “Disjoint” gives me everything outside. I have 4149 polygons that don’t touch my county. Which makes sense as I have 851 that intersect
  • “Contain” does nothing. Which doesn’t make sense as it says “contain”. If I select my county and and run against the 5000 polygons nothing happens. If I select a polygon within the county and flip my select: Give me all the counties that contain this one polygon – that works.
  • “Touch” does nothing because I expect it to be similar so overlap. Select my county and run against the polygons and nothing. Select my county and ask it to identify every county that touches my selected one and that works. My county touches 10 other counties.
  • “Equal” does exactly what I expect as none of my 5000 polygons “Equals” the geometry of my county.
  • The weirdest is “cross”. I had to do some digging. So with cross a polygon can cross another polygon but there is nothing but more polygons. Lets say a line crosses into the county – that intersection is a point. After doing some researching crosses mainly is for lines crossing other lines or polygons. Which if I do a little bit of trickery with QGIS by converting the polygons to lines and running “Select By Location”. We have 166 selected lines which matches what I have in overlap.

So anyway – Select by Location. It does everything you want and some stuff you’re not expecting. Which – this was fun and I might do it with another processing tool I should 100% understand and don’t.

You may also like

QGIS-US Updates

QGIS-US Updates

I said at the start of the year I wanted to blog once a week. I've been simplifying my website and I just want to put "more stuff" out there. Some posts may be work related - some may not be. So this isn't work - but it is work: QGIS-US. I've not said a ton about the...

The Big TN Conference Pt 2

The Big TN Conference Pt 2

...aaand I'm back home. So I've been to a lot of conferences. Some Good. Some Bad. This one was good. Better than I had hoped. So what was my main takeaway from it? They keynotes were a great contrast of people/computers. OSM is all about the people. I had no clue how...

Almost 11 months later

Almost 11 months later

I've been trying to write my thoughts down more and have just been lost in life. The last 30 days have had me in Oak Ridge, Murfreesboro, and Reston Virginia. Yet another reason I mumble I really need to cut down on traveling. Which reminds me I need to discuss...