Extracting coordinates of points and writing them to the attribute table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
(One intermediate revision by one other user not shown) | |||
Line 49: | Line 49: | ||
[[Category: FAQ]] | [[Category: FAQ]] | ||
[[Category: Import]] | |||
[[Category:HowTo]] |
Latest revision as of 14:10, 5 August 2016
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
''' '''
Import points
For the import of the CSV-File use v.in.ascii.
v.in.ascii -z input=/path/to/points_map.csv output=points format=point skip=0 x=1 y=2 z=3 cat=0 fs=,
Add attribute table for vector
Through v.db.addtable an attribute table for the points is created.
v.db.addtable map=points_map table=points_map 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_map table=points_map
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_map opt=coor columns="x,y,z"
--TimNorwey 14:01, 26 March 2011 (PDT)