How to select the area which is Not Intersects between 2 objects?

2,474 views
Skip to first unread message

beemomo

unread,
Jul 9, 2008, 6:35:58 AM7/9/08
to MapInfo-L
Hi, there everyone. I have two objects, grids and a polygon which
shaped a small island in World Map.
The grids were made around the the polygon.
When these objects are putting together, they will intersects with
each other. I wish to select the rest of the grids area which were not
intersects with the polygon.
I try to perfom the SQL query in MapInfo which sounds like this :

Select * From
Poly_Object, Grid_Object
Where Poly_Object.Obj Not Intersects Grid_Object.Obj

but an error message was displayed, "Found [intersects] while
searching for [like]". Is this because the "Not" operator is not
"compatible" with "Intersects" operator?

Can any one teach me on how to do that? Thank you.

Lars I. Nielsen (GisPro)

unread,
Jul 9, 2008, 7:20:57 AM7/9/08
to mapi...@googlegroups.com
When querying two or more tables, the first (n-1) clauses in "where" are the join clauses (with "and" in-between)

Join clauses in Pro only supports "=" or "Intersects/Within/Contains", which are all "inner" joins. Outer joins, like "<>" or "not something" are not supported.

I.e., you can only select the intersection in either table. If interactive, you can invert the selection with a menu item, but programmatically, you need to devise your own logic.


Best regards / Med venlig hilsen
Lars I. Nielsen
GIS & DB Integrator
GisPro


beemomo skrev:

beemomo

unread,
Jul 9, 2008, 8:07:39 AM7/9/08
to MapInfo-L
Thanks for your explanation, Lars I. Nielsen.
Well, I got to find another solution then.

Bemmomo

> When querying two or more tables, the first (n-1) clauses in "where" are the join clauses (with "and" in-between)
> Join clauses in Pro only supports "=" or "Intersects/Within/Contains", which are all "inner" joins. Outer joins, like "<>" or "not something" are not supported.
> I.e., you can only select the intersection in either table. If interactive, you can invert the selection with a menu item, but programmatically, you need to devise your own logic.Best regards / Med venlig hilsen Lars I. Nielsen GIS & DB Integrator GisPro

Driver, Greg 9434

unread,
Jul 9, 2008, 8:14:02 AM7/9/08
to mapi...@googlegroups.com
You could use a sub-query to achieve this:

Select * from grid_object where not obj intersects any (select obj from
poly_object)

This will select any grid object that doesn't intersect any poly
objects. It might take some time to run and it might be quicker finding
the objects that do intersect and then inverting the selection.

HTH

Greg Driver

System Administrator
Applications Support
ICT
Surrey Police
NOT PROTECTIVELY MARKED


-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Behalf Of beemomo
Sent: 09 July 2008 11:36
To: MapInfo-L
Subject: [MI-L] How to select the area which is Not Intersects between 2
objects?

Hi, there everyone. I have two objects, grids and a polygon which shaped
a small island in World Map. The grids were made around the the polygon.
When these objects are putting together, they will intersects with each
other. I wish to select the rest of the grids area which were not
intersects with the polygon. I try to perfom the SQL query in MapInfo
which sounds like this :

Select * From
Poly_Object, Grid_Object
Where Poly_Object.Obj Not Intersects Grid_Object.Obj

but an error message was displayed, "Found [intersects] while searching
for [like]". Is this because the "Not" operator is not "compatible" with
"Intersects" operator?

Can any one teach me on how to do that? Thank you.

*Internet communications are not secure and therefore Surrey Police does not accept legal responsibility for the contents of this message. This email and any attachments may be confidential. They may contain privileged information and are intended for the named addressee (s) only. They must not be distributed without our consent. If you are not the intended recipient, please notify us immediately and delete the message and any attachments from your computer, do not disclose, distribute, or retain this email or any part of it. Unless expressly stated, opinions in this email are those of the individual sender, and not of Surrey Police. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. Surrey Police reserves the right to monitor all email communications through their networks.*

beemomo

unread,
Jul 9, 2008, 9:30:22 AM7/9/08
to MapInfo-L
Thank you very much Greg Driver!! It just works fanstastic, I
appreciate your help alot!
But can you please further explain to me on this sentence -- " finding
the objects that do intersect and then inverting the selection"?

Cheers,
Beemomo
> *Internet communications are not secure and therefore Surrey Police does not accept legal responsibility for the contents of this message. This email and any attachments may be confidential. They may contain privileged information and are intended for the named addressee (s) only. They must not be distributed without our consent. If you are not the intended recipient, please notify us immediately and delete the message and any attachments from your computer, do not disclose, distribute, or retain this email or any part of it. Unless expressly stated, opinions in this email are those of the individual sender, and not of Surrey Police. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. Surrey Police reserves the right to monitor all email communications through their networks.*- Hide quoted text -
>
> - Show quoted text -

Driver, Greg 9434

unread,
Jul 9, 2008, 9:44:35 AM7/9/08
to mapi...@googlegroups.com
Beemomo,

The 'Invert selection' is an icon on the Main toolbar (black box with an arrow) or can be accessed via the Query menu. You can use this function to select objects/records that aren't currently selected. So for example, if run a SQL query to select all of the points that fall within a region object, inverting the selection will select all of the points that don't fall within the region object (i.e. NOT within).

Hope that helps.

beemomo

unread,
Jul 9, 2008, 9:56:57 PM7/9/08
to MapInfo-L
Greg Driver,

Sorry for my late reply and thank you very much for your explanation,
I can understand better now on the MapInfo Query Selection. Such a
helpful lesson!

Beemomo
Reply all
Reply to author
Forward
0 new messages