[GRASS-user] Re: grassuser Digest, Vol 11, Issue 18

Maciej Sieczka tutey at o2.pl
Thu Mar 15 18:11:50 EDT 2007


Jorge Echeverri wrote:
> You're right.
> 
> I just imported:
> 
> #'X_COORDINATE Y_COORDINATE'
> L 2 1
> 3400630.04 5718486.603 1982 2.88
> 3400639.238 5718515.776 1982 2.88
> 1 1
> L 2 1
> 3400639.238 5718515.776 1982 3.77
> 3400648.641 5718546.057 1982 3.77
> 1 182
> L 2 1
> 3400648.641 5718546.057 1982 4.7
> 3400665.041 5718562.99 1982 4.7
> 1 181
> 
> both with and without -n and it worked in the same way.
> 
> But now I have a question. This file contains not only coordinates but
> also 2 attributes: "Year" and "Depth" in the columns 3 and 4. If I
> follow the instructions of v.in.ascii manual:
> 
> "The coordinates are listed following the initial line containing the
> primitive code, the total number of vectors in the series, and the
> number of categories (1 for a single layer, higher for multiple layers).
> Below that 1 or several lines follow to indicate the layer number and
> the category number (ID)."
> 
> I rewrite my file like:
> 
> #'X_COORDINATE Y_COORDINATE'
> L 2 2
> 3400630.04 5718486.603 1982 2.88
> 3400639.238 5718515.776 1982 2.88

I don't think you can import vector in standard format together with
it's attributes using v.in.ascii. It's possible only for points format.
In standard format, the "1982 2.88" etc. after x,y coordinates are
discarded.

To add attributes to your lines vector created with v.in.ascii, you
would need to create the table separately (eg. a dbf with OO.org Calc
or OO.org Base, or using the db.execute to create the table and
populate it with values) and then attach it to your lines vector uisng
v.db.connect.

To understand how categories and layers work, please refer to the
"Vector data processing in GRASS GIS" chapter of the manual.

> 2 1
> L 2 2
> 3400639.238 5718515.776 1982 3.77
> 3400648.641 5718546.057 1982 3.77
> 1 182
> 2 182
> L 2 2
> 3400648.641 5718546.057 1982 4.7
> 3400665.041 5718562.99 1982 4.7
> 1 181
> 2 181
> 
> The last 2 in the first line for the number of attributes, isn't it? 
> And data are rightly imported:
> 
> Erzeuge Topologie ...
> 3 primitives registriert
> Building areas:  100%
> 0 Flächen erstellt
> 0 Inselflächen erstellt
> Füge Inselflächen hinzu:
> Füge Zentroide hinzu: 100%
> Die Topologie wurde erstellt.
> Anzahl von Knoten     :   4
> Anzahl von Primitives :   3
> Anzahl von Punkten    :   0
> Anzahl von Linien     :   3
> Anzahl von Boundaries :   0
> Anzahl von Zentroiden :   0
> Anzahl von Flächen    :   0
> Anzahl von Inseln     :   0
> 
> But I have to admit, I'm still confused with the concept of layer and
> category in GRASS; i.e., I wrote these lines:
> 1 182
> 2 182
> Like first line1 for Layer 1 and 182 from original line ID of my data
> and second line
> and second line for Layer 2 and 182 from original line ID of my data
> was this right?

You propbaly mean this part:

> L 2 2
> 3400648.641 5718546.057 1982 4.7
> 3400665.041 5718562.99 1982 4.7
> 1 181
> 2 181

If you wanted the given line, consinsted of 2 vertices, to have 2
attribute links (categories), one in the layer 1 and the other in layer
2, both with category number "182", you did it right.

> On the other hand how can I classify and visualise these data with
> GRASS?

d.vect, d.vect.thematic

Both available via gis.m and d.m as well as from command line. There is
also QGIS which has nice thematic mapping capabilities and reads GRASS
vectors.

P.S.

Please don't ask question offlist. It's better to let others participate.

Cheers,
Maciek




More information about the grass-user mailing list