Finding points NOT within a polygon using MapInfo

Peter Rukavina

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 Points.id,Regions.id 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 Points.id from Points WHERE not Obj within any (SELECT Obj from Regions)

Cool.

Comments

Submitted by kate on

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

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). 

You can subscribe to an RSS feed of posts, an RSS feed of comments, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email.

Search