Making Queries using the Select By Location Command - MapInfo_Pro - 2023

MapInfo Pro Help

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapInfo Pro
Version
2023
ft:locale
en-US
Product name
MapInfo Pro
ft:title
MapInfo Pro Help
First publish date
1985
ft:lastEdition
2023-09-12
ft:lastPublication
2023-09-12T16:39:16.995000

The Select By Location dialog lets you select objects from one table based on their location relative to objects in another table. In other words, it enables you to create a selection using a spatial join between two tables.

To make a query:

  1. In the Selection group on the TABLE/MAP/SPATIAL tab, click on the SQL list and then click on Select By Location. The Select By Location dialog box displays. You can also launch this command from the map window's context menu. Alternatively, press B (Shift+b) to open the Select By Location dialog box when at least two mappable tables are open, and a map window is active.
  2. Use the Select objects from and Compared to objects in drop-down lists to choose the tables from which to create the spatial join. The list of tables includes query tables as well as the current Selection if there is one.
    Note: Each item in the lists has a tool-tip showing table descriptions, if any, the table's coordinate system, and the number of records in the table.
  3. Use the Relation drop-down list to specify the spatial method to use when selecting objects from the first table in relation to objects from the second table.

    You can choose from a list of spatial operators (Contains, Contains Entire, Intersects, Within, Entirely Within) and an option for Within a Distance. When both, the Select objects from and Compared to objects in drop-down lists have a selection, the Relation list-box will automatically select and display a spatial operator that makes sense for both tables. This is based on the predominant object type in each table and whether table bounds overlap. If the table bounds don't overlap, then Within a Distance is suggested. You can change this and choose the relation you want to use.

  4. Click OK.
    Note: The OK button is not enabled until all input is valid. The input is valid when both tables are selected, and they don't refer to the same table or same base table. If Within a Distance is the selected relation, that the distance value is valid (greater than 0).
    Note: Once OK is pressed, the previous control settings are remembered and displayed the next time the user opens the dialog. If a table was previously used but is no longer open when the dialog is next opened, the combo box will be empty and the OK button disabled.
    Note: Once OK is pressed, an SQL query is constructed and added to the application's catalog of queries (it becomes available in the SQL Window's scripts list), and then executed. If any error occurs, a message box is displayed.

Using the Within a Distance Spatial Operator

When Within a Distance spatial operator is selected, a text-box for distance, distance units drop-down, and an option to select a distance calculation method becomes visible.

Note: The units drop-down is initialized to your system preference for Distance (System Settings in the Backstage).

By default, the Spherical distance calculation method is selected, and Within a Distance uses the ObjectDistance() MapBasic function to find the minimum distance between two objects. The function uses a spherical calculation method for the return value in the units selected. If the calculation cannot be done using a Spherical distance method (for example, if the first object's Table Coordinate System is NonEarth), then the Cartesian distance calculation method is used.

You can also select Cartesian as the distance calculation method (this uses the CartesianObjectDistance() MapBasic function). CartesianObjectDistance() returns the minimum distance between two objects using a Cartesian calculation method for the return value in the units selected. If the calculation cannot be done using a Cartesian distance method (for example, if the first object's Table Coordinate System is Lat/Long), an error dialog box is displayed.

See Also: