Extracting coordinates of points and writing them to the attribute table: Difference between revisions
Jump to navigation
Jump to search
⚠️TimNorwey (talk | contribs) (Created page with "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: <sourc...") |
(No difference)
|
Revision as of 21:01, 26 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=/.../.../.../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 driver=dbf database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ table=points key=cat layer=1
Add columns
Use v.db.addcol to add the columns to the attribute table.
v.db.addcol map=points layer=1 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)