Milo van der Linden writes:

> But I can't see this exercise being a problem with a single point in a
> not to big region so I think your problem revolves from performance
> problems on large regions or a large set of points.

Right. It's only a problem on the largest objects. It's just that I sense
a "code smell" that tells me that looping through all nodes is
inefficient, and I wondered if there's a more elegant solution.

> What you might consider is first doing radius select to decrease the
> number of nodes tested. For instance, do a radius search with a diameter
> of 1 mile, if the count of the objects returned is larger then zero, do
> your calculation, otherwise increase the radius with certain steps.
> (Think big, start small) This is a matter of fine tuning for your
> specific situation. For objects that are near the center of a big region
> this will always be a problem.

This won't help because the nodes in MapInfo objects cannot be accessed
directly with MapInfo's higher spatial functions. You still have to
examine every point and determine if it's in the buffer or not. And if
you're going to have to do that, the fastest algorithm is still just the
"brute force" method of comparing every point to the given X,Y coordinate.

There's only one other hope that I can think of. There is the
ExtractNodes() function, which is a fast way to extract a sub-polyline
object from a polyline or region object. Can we use this?

If there are n nodes in an object, and you use ExtractNodes() to pull
nodes 1 to n/2 and find that the Minimum Bounding Rectangle (MBR) of the
returned object is not in your area of interest, then you can immediately
eliminate nodes 1 to n/2 from your search. That is a faster way to
eliminate nodes (if you're lucky) than the brute force method. But of
course, this won't always yield cool results, because the sequence of
nodes has nothing to do with their spatial distribution, but is it worth
exploring ExtractNodes()?

Is there anyone interested in applying the lever of their mind to this
problem who isn't afraid that the effort might also flip their brains out
between their ears? 

- Bill Thoen


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13991

Reply via email to