Dan,

This is not really difficult, just long:


make sure your two tables have a common field that will link all records in the two 
tables (e.g. have a field in each table with only 1's in them for instance - I'll call 
them "common").

Then use the following query:

Select  TableA.Identifier,TableB.Identifier, 
        
Distance(CentroidX(TableA.Obj),Centroidy(TableA.Obj),centroidx(TableB.Obj),centroidy(TableB.Obj),"km")
 

from    TableA, TableB

where   TableA.common=TableB.common and 
        
Distance(CentroidX(TableA.Obj),Centroidy(TableA.Obj),centroidx(TableB.Obj),centroidy(TableB.Obj),"km")
 <50 

into    Selection



The first part of the WHERE clause links all records in the two tables (there is 
probably a more elegant way to do this, but this way works), while the second parts 
checks whether the distance between the points is less than 50 km. 

The SELECT clause gives you the identifiers for the matching pairs and the distance 
betwen them.


Good luck


Mark Knudsen
__________________________________________________________________

 Veitch Lister Consulting Pty Ltd        Phone: +61 3 9427 7400
 Suite 14    663 Victoria Street         Fax:     +61 3 9427 0481
 ABBOTSFORD  VIC  3067                   email: [EMAIL PROTECTED]
__________________________________________________________________

-----Original Message-----
From:   [EMAIL PROTECTED] 
Sent:   Wednesday, March 01, 2000 8:03 AM
To:     [EMAIL PROTECTED]
Subject:        MI Distance Query

I have two layers or two databases in which one of them contains over 600 points
(lets call it table A) and the other about 200 points (table B). I would like to
select from table A all the points that are at least within a 50 km radius from
each point in table B. In other words I would like to have a list of the records
in table A that are at least 50 km of a record in table B and in that list also
indicate the record from table B that matched. Can this be done in a simple
query? What would be the easiest way to do this? Any help is appreciated.

Thanks,

Dan Page
[EMAIL PROTECTED]




----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to