Hi Christian,
Using MapBasic, setup a Nested For Loop.
*****************************************************************
Dim nLoop, nInnerLoop As Integer
Dim fDistance As Float
Dim fX1, fY1. fX2, fY2 As Float
For nLoop = 1 to TableInfo(TableA, TAB_INFO_NROWS)
Fetch Rec nLoop from TableA
fX1 = CentroidX(TableA.obj)
fY1 = CentroidY(TableA.obj)
For nInnerLoop = 1 to TableInfo(TableB, TAB_INFO_NROWS)
Fetch Rec nInnerLoop from TableB
fX2 = CentroidX(TableB.obj)
fY2 = CentroidY(TableB.obj)
fDistance = Distance(fX1, fY1, fX2, fY2, "mi")
Print "The Distance from TableA Store "+nLoop+" to TableB
Store "+nInnerLoop+" is "+fDistance
Next
Next
*****************************************************************
Yes this can be put into smaller code, but this should appear readable and
logical. I've not checked it so there could be some simple errors.
Hope it helps
Mark Crompton
-----Original Message-----
From: christian ormond [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 10, 2000 2:17 PM
To: Mapinfol
Subject: MI. Measuring distancce
I have a table with a of 200 stores (Table A) and their lat longs and
another group of 1600 stores (Table B) with their lat longs. How in a
sql statement would I find distance from all the stores in Table A to
Table B. I can figure out how to do it from a specific store lat/long
i.e. -71.2555, 42.15222 to the centroidX(obj) Centroidy(obj) "mi" but
can not figure out how to get more than one store in a one step batch.
Any suggestions.
Should look like:
Table A Store #1.....Table B Store #1...1.1 mi
Table A Store #1.....Table B Store #2...1.3 mi
Table A Store #1.....Table B Store #3...1.5 mi
Table A Store #1.....Table B Store #4...2.4 mi
Table A Store #2.....Table B Store #1...5.8 mi
Table A Store #2.....Table B Store #2...7.1 mi
Table A Store #2.....Table B Store #3...10.8 mi
Table A Store #2.....Table B Store #4...15.7 mi
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]