[GRASSLIST:4517] Re: multiple field....

Radim Blazek blazek at itc.it
Wed Oct 13 06:32:20 EDT 2004


Field is not column in GRASS (too late to change it).

On Tuesday 12 October 2004 19:39, Massimiliano Cannata wrote:
> Hiello everybody,
>
> I'm trying to  write a code to create a point map (in 5.7 version) with
> 6 field but I have some great doubt.....
> I guess I have to create 1 coor file with 6 fields (columns) like this:
>
> point_id | x | y | z | field_1 | field_2 | ....... | field_6
>
> and 6 tables with attributes: one for every field.......
>
> table for field_1:
> cat | attribute_1 | attribute_2 | ........ | attribute_n
>
> table for field_2:
> cat | attribute_1 | attribute_2 | ........ | attribute_n
>
> etc.....
>
> my question are:
>
> with the following code do I create a field_info struct for the field_1
> or with 1 field?
> Fi = Vect_default_field_info ( &Map, 1, NULL, GV_1TABLE );
>
> and with the foolowing code do I create the table for field_1 ( cat |
> attribute_1 | attribute_2 ) ?
>
> db_zero_string (&sql);
> sprintf ( buf, "create table %s ( cat integer", Fi->table );
> db_append_string ( &sql, buf );
> db_append_string ( &sql, ", attribute_1integer" );
> sprintf ( buf, ", attribute_2 varchar(%d)", clen );
> db_append_string ( &sql, buf );
> db_append_string ( &sql, ")" );

I think, that you need just one table.
Add all the columns to this statement and create the table.

Look in vector/v.in.sites/main.c

Radim




More information about the grass-user mailing list