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

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Thu Aug 12 11:28:10 EDT 2010


Guys, you are amazing. No other comments!

Nikos A:

> > time v.what.vect --v vector=pareto_ref_points___pareto_ref_30m
> > qvect=pareto_grid___OVER___ref_coi_points___pareto_grid___OVER___ref_30m_
> > __ON___classification_V___classification_1_500m column=gridcell_1
> > qcolumn=cat
> > -->%---

> > Now this is crawling and I am waiting [*]. Didn't wanna let you waiting
> > too long to know that this keeps me waiting - so I've hit the Send
> > button :-p

Moritz Lennert wrote:
 
> Found the culprit !

:D

> Actually the problem is in v.db.dropcol which for the SQLite driver also
> drops all indices (it creates a new table without the dropped column and
> populates with a select from the old table). This means that there is no
> index on the cat column which makes v.distance really slow.
> 
> I'm not sure about indices in the dbf driver, but would think that there
> are none...
> 
> So, a quick solution for you would be to recreate the index after the
> v.db.dropcol (all this is happening in your pareto_1 script):
> 
> echo "CREATE UNIQUE INDEX any_name_for_index on yourtable ( cat )" |
> db.execute

A-ha! Here you go... so it's my fault!
 
> (don't know how to do this in a python script...)

No worries, I'll fix that, allthough I'm (still) rather slow with Python (yet, 
I will not be forever).

> 
> Another (dirty) solution is to copy your map after the v.db.dropcol:
> 
> g.copy vect=pareto_ref_points___pareto_ref_30m,test
> 
> This automatically creates the index in test, and so
> 
> time v.what.vect --v vector=test
> qvect=pareto_grid___OVER___ref_coi_points___pareto_grid___OVER___ref_30m___
> ON___classification_V___classification_1_500m column=gridcell_1 qcolumn=cat
> 
> should be fast again...
> 
> I don't have time right now, but I'll look into adding the index
> creation into v.db.dropcol, if you confirm that this is the problem.

I am breaking the never-ending process... who cares what "time ..." will 
return. It is still running!!

Nikos


More information about the grass-dev mailing list