[GRASS-user] Python-Loop over points

Glynn Clements glynn at gclements.plus.com
Fri Apr 8 21:09:32 EDT 2011


Johannes Radinger wrote:

> > > Do you think that is the best way to loop over points..?
> > 
> > Only if the number of points is small. Otherwise, you're better off
> > putting them into a table and using a join.
> 
> 
> What do you mean with your method (table and join)?

Rather than executing a separate query for each rowid, create a table
containing all of the rowids then (via db.select):

	SELECT input.rowid, input.x, input.y
	FROM input, rowids
	WHERE input.rowid = rowids.rowid

Note: the DBF driver doesn't support joins (which is a good reason not
to use the DBF driver).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list