Finding points NOT within a polygon using MapInfo

Let’s say you have a MapInfo polygon layer called “Regions,” and a point layer called “Points.” You can get find out which Region each Point is inside using a MapInfo SQL query like:

SELECT, from Points,Regions WHERE Points.Obj WITHIN Regions.Obj

But what if you want to do the opposite: get a list of all of the Points that are outside any Polygon (you might call them “orphans”). You can do this:

SELECT from Points WHERE not Obj within any (SELECT Obj from Regions)



Think Brown's picture
Think Brown on August 16, 2007 - 05:46 Permalink

Tried this but unfortunately it doesn’t work. Can you post screen shots of the entire process?

Peter Rukavina's picture
Peter Rukavina on August 16, 2007 - 13:54 Permalink

Sorry — don’t have MapInfo any longer.

kate's picture
kate on November 15, 2012 - 13:25 Permalink

I have just used this thread and thought i would update it. the SQL worked for me. see the following :

in the from Tables:
select the points file from the Tables drop down list at top right of SQL dialogue box

in the where Conditions:

Not Obj Within Any (Select Obj from HAN_SA_POLY)

obviously, the Han_SA_POLY section being replaced with the name of your Regions/polygon layer you are searching outside of.

hopefully this clarifies it

gborella's picture
gborella on December 8, 2016 - 06:19 Permalink

10/10 would query again