This section includes some tasks that will be useful in handling records after you have geocoded your table.
Finding and Examining Ungeocoded Records
Once you have completed a geocoding session, you might want to find all the ungeocoded records and examine them to see what the problems are. On the TABLE tab, in the Selection group, click SQL Select to do this.
When you do not have a column for result codes, you should select all records that meet this condition:
not obj
Obj
(or object
) is a keyword MapInfo Pro uses to refer to a graphic object. Records that have been geocoded have an object, and therefore fail to meet this condition. Records that have not been geocoded meet the condition.
When you have specified a result code, select all records meeting this condition:
result_code < 0
Extracting Longitude and Latitude from a Geocoded Table
To extract the longitude and latitude coordinates from a geocoded table, you can either create a new table containing the latitude and longitude for each of the points in your original table, or use the Update command to put the longitude and latitude into the original table. The original table must be geocoded for these processes to function correctly.
Extracting Longitude and Latitude into a New Table
In this example we will create a new table, called CUSCOORD, that contains the latitude and longitude for each of the points in the original table, AUS_CUST.
- On the HOME tab, in the File group, on the Open list, click Table and choose Browser in the Preferred View drop-down list.
- On the HOME tab, in the Selection group, click SQL Select and fill in the SQL Select dialog box.
Any columns from the AUS_CUST table that you would like to appear in the CUSCOORD table should be listed in the Select Columns box; then add the centroidX(obj) and centroidY(obj) functions to this list.
- Click OK to execute the query.
- On the HOME tab, in the File group, click Save Copy As and save the resulting CUSCOORD table.
Original Table:
Resulting Table:
Extracting Longitude and Latitude into the Original Table
The following process will let you update your original table with the latitude and longitude coordinates.
- On the TABLE tab, in the Maintenance group, click Table, and Modify Structure.
- To add two new columns to your table, click Add Field and name the columns. They should be defined as decimal (13,6). For this example, the columns are called
Xcoord
andYcoord
. - After adding the columns, click OK. When you return to your main MapInfo Pro window, the file will not be displayed. To redisplay your table, on the TABLE tab, in the Content group, click New Browser.
- On the TABLE tab, in the Edit group, click Update Column. Specify your table and your column to update.
In the next example, we are updating the
Xcoord
column. The Get Value from Table portion of the dialog box will be the same table as specified in the Table to Update box. In the Value portion of the dialog box, you can type in Centroidx(obj) or you can click the Assist button to display the Expression dialog box.Click Functions and choose Centroidx from the list and click OK.
- Fill in the Update Column dialog box and click OK.
- Repeat step 3 to update the
Ycoord
column. Substitute Centroidy(obj) instead of Centroidx(obj).
Extracting a Table in a Projection Other than Longitude/Latitude
MapInfo Pro maps have two attributes that affect the coordinates of objects within the map; these are the coordinate system of the map and the coordinate settings of the Map window. To correctly extract the x and y coordinates of a projected earth map, both the Map window and the map's internal coordinates must reflect the same coordinate system. In MapBasic, the SET MAP statement sets the coordinate system for the Map window, while the COORDSYS clause sets the internal coordinates.
To extract coordinates from a projected map in the native coordinate system of the table:
- Display a map of the geographic area that you are working in.
- On the HOME tab, in the Windows group, click Tool Windows, and click MapBasic from the list, to open the MapBasic window.
- Type:
SET COORDSYS TABLE TABLENAME
. TABLENAME is the table that you are extracting coordinates from. - Press Enter. This sets the internal MapBasic coordinate system equal to the table given.
- Update the x, y values with the CentroidX and CentroidY functions.