Stephen:
I had a similar problem - I needed to find the distance from a number of
given points to their nearest contour line of a given height. This was
before I found this list, so I solved it in a typical O'Brien brute-force
manner, using a kind of binary chop algorithm:

For each point I created a buffer (with 32 sides as a compromise between
size and circularity) and checked for intersection with the line. If no
intersection, I doubled the buffer radius and tried again.

Once intersection had been achieved I used the usual binary chop method to
successively change the radius by halving increments (adding if no
intersection, subtracting if intersection) until the increment size was
within the tolerable error (I used 0.1 metre).

It worked, but is NOT elegant, and I'll send a .mb file should you so wish.
But I DO hope that someone has a better answer - when applied to a grid of
2,000,000 points it took several weeks of overnight runs (on a P166) to
complete!

Would I do it that way again? No, I'd post on this list and hope!

----- Original Message -----
From: Stephen R. Riese <[EMAIL PROTECTED]>
To: MapInfo <[EMAIL PROTECTED]>
Sent: Friday, December 31, 1999 9:01 PM
Subject: MI Looking for Nearest Object Distance Functions


>
> Greetings,
>
> I'm new to MapInfo/MapBasic and this list server.  I'm looking for a
> function that will return the distance from a given point to the nearest
> object of a certain type.  For example, from point (x, y) to the nearest
> house (point object), road or river (linear object) or nearest forrest
> (area object).  All of the functions I've come across give the distance
> between two known points.  I need to find the closest object  first (e.g.,
> which house or river is closest -- hard to do) and then determine the
> distance (easy to do).
>
> Is there some way to avoid an exhaustive search?  I need to make tens of
> thousands of these calculations, each one selecting the nearest of up to
> hundreds of similar objects.  In addition, each linear and area object are
> defined by two or more points.  I assume I'll need to determine which
point
> within each of these objects is closest to the known (x, y) point.
>
> Thanks for any help you can provide and Happy New Year!
>
> [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