Extracting coordinates of points and writing them to the attribute table: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 7: Line 7:
674065.99100,3367983.83600,40.24
674065.99100,3367983.83600,40.24
674065.92600,3367985.70100,26.00
674065.92600,3367985.70100,26.00
''' '''
</source>
</source>
__TOC__
__TOC__
=== Importing points ===
=== Import 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}}.


<source lang="bash">
<source lang="bash">
v.in.ascii -z input=/path/to/points.csv output=points format=point skip=0 x=1 y=2 z=3 cat=0
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=,
</source>
</source>


Line 20: Line 22:


<source lang="bash">
<source lang="bash">
v.db.addtable map=points layer=1 table=points columns="cat integer"
v.db.addtable map=points_map table=points_map columns="cat integer"
</source>
</source>


Line 27: Line 29:


<source lang="bash">
<source lang="bash">
v.db.connect -o map=points table=points
v.db.connect -o map=points_map table=points_map
</source>
</source>


Line 41: Line 43:


<source lang="bash">
<source lang="bash">
v.to.db map=points opt=coor columns="x,y,z"  
v.to.db map=points_map opt=coor columns="x,y,z"  
</source>
</source>


Line 47: 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)