[GRASS-user] Still something wrong importing with v.in.ascii and connecting to DB

Hi,

Regarding my question yesterday. I am again trying to depict the attributes already mentioned:

1.I performed a MySQL-query on tbl_node and tbl_line to obtain the couples of points defining a line and stored this in a .csv-file and into a new table in my database, tbl_attributes. This table also contains the attributes I need.

tbl_attributes
“SECTION_ID”,“X_ANFANG”,“Y_ANFANG”,“X_ENDE”,“Y_ENDE”,“Baujahr”,“Laenge”,“Gebiet”,“MTiefe”,“KNutzung”,“Material”,“PArt”,“PBreite”,“PHoehe”,“ANALYSIS_CHAPTER”
1,3400630.04,5718486.603,3400639.238,5718515.776,1982,30.59,“Niederaden”,2.88,1,“Beton”,1,300,300,1
182,3400639.238,5718515.776,3400648.641,5718546.057,1982,31.71,“Niederaden”,3.77,1,“Beton”,1,300,300,1

  1. I created a new file with an awk-programm:
    L 2 11
    3400630.04 5718486.603
    3400639.238 5718515.776
    1 1
    6 6
    7 7
    8 8
    9 9
    10 10
    11 11
    12 12
    13 13
    14 14
    15 15
    L 2 11
    3400639.238 5718515.776
    3400648.641 5718546.057
    1 1
    6 6
    7 7
    8 8
    9 9
    10 10
    11 11
    12 12
    13 13
    14 14
    15 15
    Each line having a series of layers each associated to a category number!? Is this right?

  2. I could load these data with v.in.ascii into GRASS

  3. And I also could connect this vector file with the tbl_attributes in my DB

The problem is when I try to display the data. Using QGIS I realised that the entire vector file takes the attributes from the first record??? I tried the same with GRASS using d.vect.thematic and have the same problem:( What did I do wrong? I don’t find out the answer. Any ideas???

Thanks

Jorge

Hi,

I need to do the following:

Display a sewer network and generate charts with classification in a colour scale based on attributes like Age, Material, Diameter, etc.

Data are in a MySQL database:

The network is geometrically defined by the relationship between these two tables:

tbl_line:
“LINE_ID”,“FROM_NODE_ID”,“TO_NODE_ID”
1,1,2
tbl_node
“NODE_ID”,“X_COORDINATE”,“Y_COORDINATE”,“Z_COORDINATE”,“NET_TYPE_ID”
1,3400630.04,5718486.603,1,

Assuming that attributes where also stored in the same table: tbl_line, which is not the case, how would be the better way to perform this task? Attributes are actually stored in another table, tbl_basedata, which is in the same database and has a 1:c relationship to tbl_line.

So far I have managed to connect to the MySQL-database but cannot figure out how to further proceed.

Previously I had tried following workaround:
1.I performed a MySQL-query on tbl_node and tbl_line to obtain the couples of points defining a line and stored this in a .csv-file.
2. From this I created a new file with an awk-programm like this:
#‘X_COORDINATE, Y_COORDINATE’
L 2 0
3400630.04 5718486.603
3400639.238 5718515.776
L 2 0
3400639.238 5718515.776
3400648.641 5718546.057
L 2 0
3400648.641 5718546.057
3400665.041 5718562.99
L 2 0
3400665.041 5718562.99
3400625.996 5718597.349
L 2 0
3.I successfully imported this with v.in.ascii and can depict the geometry.

But I don’t think that is the most logical way to do it as GRASS can connect directly to the DB. Any suggestions???