[GRASS-dev] About v.distance, v.what.vect (wrt "count points within...").

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Tue Aug 10 05:36:08 EDT 2010


Nikos Alexandris wrote:

> >> "v.distance" is slow (for the impatient user) with very large vectors
> >> (from my
> >> memory I estimate that it took ~20h for ~600.000 features). Trying to
> >> get the
> >> "dmax=" first in order to tell "v.distance" to look for features within
> >> a certain radius, might _not_ be very efficient as well. It takes time
> >> to get
> >> results from "v.distance -pa" and, depending on the vector(s), the
> >> addition of
> >> the _real_ v.distance can be a deal-breaker.

Moritz Lennert:

> > Just an innocent question (partly directed to Markus M): could this be
> > linked to the spatial index ? And is v.distance faster with spatial index
> > on file in grass7 ?

Markus Metz:

> No consistent speed difference between grass 6.x and grass 7.
> Sometimes grass 6 is faster, sometimes grass 7, but nothing dramatic.
> The time-consuming parts are distance calculations and tests whether a
> point is inside an area or inside an isle of an area. These
> calculations should be done only when necessary. I have added some
> tests using bounding boxes to my local copy to avoid
> distance-from-point-to-line calculations; in combination with dmax and
> without -a there is a real speed gain for point to area distances, but
> I need to do more testing to make sure results stay identical.
 
> It might save some time to get distances from points to centroids
> first with -p (I don't think -a is necessary) because getting
> distances to centroids is much faster than getting distances to areas.

"Area = boundary + centroid", so what exactly is the point to area distance? 
Point to boundary? Specifically, point to all-lines that compose a boundary? 
Many distances? And then, keep the maximum?

Oh, I am still not within the logic of how exactly the "within area" point 
detection works.

> Grab the maximum distance and use that as dmax with to_type=area. This
> should be safe because the real maximum distance to areas should be
> smaller than the maximum distance to area centroids.

Markus, would you mind pointing out the code lines where distance measuring 
(points to areas) is happening? I'll give it a try but it is (so) time 
consuming for an ignorant like me.

Thanks, Nikos


More information about the grass-dev mailing list