[GRASS5] ps.map symbol size from DB column

Hamish hamish_nospam at yahoo.com
Tue Sep 6 04:42:56 EDT 2005


Hi,


I have done most of the code for getting ps.map to do dynamic symbol/eps
sizing from a DB column, following the d.vect.chart interface. The
sizing part and variable passing is all complete (currently scaling ok 
from cat number), but I need two things:


(1) I would like to check that the sizing column name exists and is of a
numerical type.

We have Vect_get_column_names_types(Map, layer) in 
lib/vector/Vlib/dbcolumns.c which returns a list of column names and
types. It would be great to have another fn in dbcolumns.c like

Vect_column_name_is_type(struct Map_info *Map, int field, char *col_name);

returning the type or NULL if the column doesn't exist.

This seems like a useful thing to have, and I think it would be pretty
simple to do (just parse the output of Vect_get_column_names_types() ).

Maybe if something is wrong then the vector/db library fn's already give
a good error message so there is no need to test?

Maybe this already exists?



(2) I want to do something like:

symbol_size = Vect_db_read(Map, layer, column_name, cat);

to query the value for that category-column combination. How?

(maybe with an atof() or sscanf("%lf",) step if it returns a string; or
perhaps multiple fn's like Vect_db_read_dbl() and Vect_db_read_str() ??)



Preferably the fn's asked for in (1) and (2) should both be abstracted to
the point where one shouldn't need to be opening DB drivers, etc.


????
sorry, I don't know the DB stuff very well.



thanks,
Hamish




More information about the grass-dev mailing list