Extracting coordinates of points and writing them to the attribute table: Difference between revisions
Jump to navigation
Jump to search
m (→Add columns) |
mNo edit summary |
||
Line 1: | Line 1: | ||
The workflow below describes how coordinates can be extracted from points and how they can be written into the attribute table. | The workflow below describes how coordinates can be extracted from points and how they can be written into the attribute table. | ||
Line 9: | Line 8: | ||
674065.92600,3367985.70100,26.00 | 674065.92600,3367985.70100,26.00 | ||
</source> | </source> | ||
__TOC__ | |||
=== Importing points === | === Importing points === | ||
For the import of the CSV-File use {{cmd|v.in.ascii}}. | For the import of the CSV-File use {{cmd|v.in.ascii}}. |
Revision as of 07:20, 27 March 2011
The workflow below describes how coordinates can be extracted from points and how they can be written into the attribute table.
The example is based on a CSV-File:
674065.18600,3367985.59300,25.83
674066.43200,3367982.46800,25.96
674065.99100,3367983.83600,40.24
674065.92600,3367985.70100,26.00
Importing points
For the import of the CSV-File use v.in.ascii.
v.in.ascii -z input=/path/to/points.csv output=points format=point skip=0 x=1 y=2 z=3 cat=0
Add attribute table for vector
Through v.db.addtable an attribute table for the points is created.
v.db.addtable map=points layer=1 table=points columns="cat integer"
Connect the vector to the attribute table
Use v.db.connect to connect the vector with its corresponding table.
v.db.connect -o map=points table=points
Add columns
Use v.db.addcol to add the columns to the attribute table.
v.db.addcol map=points columns="x double precision, y double precision, z double precision"
Add coordinates
Use v.to.db to write the coordinates of the points into the attribute table.
v.to.db map=points opt=coor columns="x,y,z"
--TimNorwey 14:01, 26 March 2011 (PDT)