VERIFIED SOLUTION i
X

Find all polygon objects that exists wholly within other polygon objects in the same layer - MapInfo Professional

UPDATED: May 4, 2017


Comparing Objects Entirely within other Objects in the same layer/table

In order to make a spatial comparison between objects in MapInfo Professional, you can use the SQL Select functionality to achieve this.

The SQL Select query always imposes an INNER JOIN between tables, so it is not possible to reference the same table twice in the dialog to make the spatial comparison. It's because of this, these entities need to exist in there own tables.

Scenario

You would like to see which polygons exist wholly within other polygons within the same layer/table, but you do not wish to compare the same shape against itself.

Important: In order to successfully achieve this, your table will need a column that contains unique records for each row of data. This know as the Primary Key.

Instructions

1. Open your table in MapInfo Professional.
2. For 64-bit, select HOME > Save (Menu) > Save Copy As. For 32-bit, select File > Save Copy As. Name this table temp_table.TAB
3. Open the newly created table in MapInfo - temp_table.TAB
4. For 64-bit, select TABLE > SQL Select. For 32-bit, select Query > SQL Select.
5. Leave the Select Columns input as default (This should be an asterix symbol (*)).
6. Select the from Tables input, then select the Tables menu from the right side of the screen. Select both your original_table and the temp_table.
a. This should then give you a similar syntax in the input - original_table, temp_table
7. The where Condition input may have already defaulted to the primary key for the table. If it hasn't then use the Columns menu to select the Primary Key columns from each table.
8. Ensure that the Browse Results checkbox is ticked, then select OK. This will then display all the polygons that are entirely within another polygon on the map, but not including themselves.
a. If the column name was primary_key then the syntax would be as follows:
original_table.primary_key temp_table.primary_key
b. At this point we need to put an operator between these two columns. Select from the Operator menu to the right of the dialog, or type <>. So the syntax should now read: 
original_table.primary_key <> temp_table.primary_key
c. Now we need to add in the object criteria. Select the where Condition input and move your carat to the end of the text. Type a space, the word and, and another space. So the syntax should now read:
original_table.primary_key <> temp_table.primary_key and
d. Now select the object columns from the Columns menu, and between these two columns type the words entirely within. The final syntax should read:​
original_table.primary_key <> temp_table.primary_key and original_table.obj entirely within temp_table.obj
8. Ensure that the Browse Results checkbox is ticked, then select OK. This will then display all the polygons that are entirely within another polygon on the map, but not including themselves.
 

Environment Details

Product affected: MapInfo Professional
 

Downloads

  • No Downloads