Hi Frank

If your need is to find the nearest point within the same table (and don't
want the point itself), use this approach:

1) Add a field called "link" of type integer to your table.
2) Save a copy of the table and open the copy.
3) Type "set coordsys table mytable" in a mapbasic window.
4) Run these queries:

select MyTable.id, MyTable2.id,
distance(CentroidX(MyTable.obj),CentroidY(MyTable.obj),CentroidX(MyTable2.ob
j),CentroidY(MyTable2.obj),"km" )
from MyTable, MyTable2
Where MyTable.link=MyTable2.link and MyTable.id<>MyTable2.id
Order by col1, col3
Into Join

select *
from Join
Group by col1
Order by col1

Unfortunately this method is quite slow on big datasets.

Regards
Uffe Kousgaard
www.routeware.dk



----- Original Message -----
From: "Frank Tanser" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 8:56 AM
Subject: MI-L distance to nearest point


> Hi List
>
> Please can you help me.  I have a table of approximately 10 000 points
each
> with a unique ID.  For each point I want to be able to derive the ID of
the
> nearest point and the distance to that point.  Does anyone know of an
> existing utility that can perform this calculation? Alternatively can
> someone tell me how to write a simle mapbasic utility to do this
> calculation?
>
> Many thanks for your anticipated response.
>
> Frank
>
>
>
>
>
>
>
>
>
> _______________________________________________________________________
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, send e-mail to [EMAIL PROTECTED] and
> put "unsubscribe MapInfo-L" in the message body.
>
>





_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to