[GRASSLIST:4611] Re: One other question.

Radim Blazek blazek at itc.it
Tue Oct 1 03:12:59 EDT 2002


On Tuesday 01 October 2002 05:14 am, Dave Graham wrote:
> Oh yeah, one other question:
>
> We've got a MASSIVE ammount of unreferenced x,y data right now, that we're
> about to sort by Township and Section.  I was thinking about creating a
> database to go along with it, to link each job number to, say, a Client's
> Name, brief job description, address, date, etc.  What I was wondering was
> how GRASS handles databases -- in other words, if I create an Excel
> spreadsheet and export it to a comma delimited file (ASCII, .CSV) will I be
> able to load it in GRASS to create, say, a list of Clients within a given
> Section?
>
> If so, is there anything I should know about designing that spreadsheet?

Database support is not yet optimal in GRASS 50, but you can do easily
what you want, I think. 

First, spreadsheet is not database and you will get to problems sooner
or later. I would recommend Access if you like MS or StarOffice database or 
real RDBMS like Postgres or MySQL. 
Once you have table with x,y and ODBC connection to your database, you can 
first display your points by d.db and query by d.what.db. (Note that it 
should be possible to connect GRASS/Linux to Access/Win by ODBC to ODBC 
bridge.) Another option of course is to create sites in GRASS.
Then if you want for each point in DB, a number of the area it is within,
I would propose some chain like this:
echo "select x,y,id from clients" | db.selecet -h \
  | sed (some tricks to get v.what imput) | v.what \
  | sed (some tricks to get SQL update: section = xxx where id = nnn) \
  | db.execute
If you run this in GRASS/Linux, you get updated table in Access/Win
with section numbers (may be). In Access you can generate fantastic forms.
(But not too long because Access always renders printed pages from the 
beginning (keeps in memory) and if you have some graphics on the page, like 
foto of client - (I know, not usual) it crashes around page 25:). 

Radim







More information about the grass-user mailing list