[GRASS-dev] v.what and spatial index
glynn at gclements.plus.com
Thu Sep 14 02:46:42 EDT 2006
Moritz Lennert wrote:
> >>>> How would this change from the first approach (if v.what could easily be
> >>>> made to accept multiple coordinates) ? This would again mean 'blindly'
> >>>> collecting points before seeing the results, or having to call v.what
> >>>> multiple times.
> >>> v.what would read one coordinate pair, perform the lookup, write out
> >>> the result(s), repeat until EOF.
> >>> gis.m would start one v.what process; each time you click the mouse
> >>> button, it would send the coordinates to the v.what process, read the
> >>> result, then display it. It would need to restart v.what if the set of
> >>> maps changed, but could use a single process to look up multiple
> >>> points.
> >> Here's my attempt at applying what you suggest. It's not very
> >> complicated, and seems to work fine here, but I'd appreciate if someone
> >> could check that I didn't do anything wrong before committing.
> > One issue which won't show up when running it directly from the shell,
> > but will if you run it via pipes: you need to explicitly set stdin and
> > stdout to line-buffered operation with e.g.:
> > setvbuf(stdin, NULL, _IOLBF, 0);
> > setvbuf(stdout, NULL, _IOLBF, 0);
> Just to show my ignorance: why stdout ? I'm only using stdin, or ?
v.what would read coordinates from stdin and write information
regarding the point/line/area at (or near) those coordinates to
See vector/v.what/what.c; there are 25 occurrences of "stdout" in that
Actually, as what() always calls fflush(stdout), you can omit the
setvbuf() call for stdout.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev