<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body dir="ltr" bgcolor="#ffffff" text="#000000">
<p style="margin-bottom: 0cm; margin-top: 0pt;">TimNorwey wrote:<br>
</p>
<blockquote cite="mid:1300909172463-6201677.post@n2.nabble.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">Could there be other extraneous values somewhere in the original ascii
file? Maybe rows with an extra comma, or other characters? Can you make
a bunch of rows available online somewhere so that we can have a look?
</pre>
</blockquote>
<pre wrap=""><!---->Returns v.in.ascii no error if I´m importing something that isn´t in the
right format?
Here a part of my csv file:
<a class="moz-txt-link-freetext" href="http://osgeo-org.1803224.n2.nabble.com/file/n6201677/testData.csv">http://osgeo-org.1803224.n2.nabble.com/file/n6201677/testData.csv</a>
testData.csv
</pre>
</blockquote>
Hi Tim:<br>
I was able to import your data with no problem. Here are the steps I
did to also get the x-y-z values into the attrib table:<br>
<br>
# Do the import. Note the -v to make a 3D vector<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > v.in.ascii -z fs=,
in=mytestData.csv col="x_coord double, y_coord double, z double" x=1
y=2 z=3 out=tim_points<br>
Scanning input for column types...<br>
Maximum input row length: 31<br>
Maximum number of columns: 3<br>
Minimum number of columns: 3<br>
Importing points...<br>
100%<br>
Building topology for vector map <tim_points>...<br>
Registering primitives...<br>
20000 primitives registered<br>
20000 vertices registered<br>
Building areas...<br>
100%<br>
0 areas built<br>
0 isles built<br>
Attaching islands...<br>
Attaching centroids...<br>
100%<br>
Number of nodes: 20000<br>
Number of primitives: 20000<br>
Number of points: 20000<br>
Number of lines: 0<br>
Number of boundaries: 0<br>
Number of centroids: 0<br>
Number of areas: 0<br>
Number of isles: 0<br>
v.in.ascii complete.<br>
<br>
# Set the default db conection to sqlite<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > sqlite3
../grass/Tim/PERMANENT/sqlite.db<br>
SQLite version 3.7.3<br>
Enter ".help" for instructions<br>
Enter SQL statements terminated with a ";"<br>
sqlite> .q<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > eval `g.gisenv`<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > db.connect dri=sqlite
database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db<br>
<br>
# Now create the attribute table with 3 columns<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > v.db.addtable
tim_points col="x_coord double, y_coord double, elev double"<br>
Using vector map name as table name: tim_points<br>
Creating new DB connection based on default mapset settings...<br>
Creating table with columns (cat integer, x_coord double, y_coord
double,<br>
elev double)<br>
The table <tim_points> is now part of vector map
<tim_points> and may be<br>
deleted or overwritten by GRASS modules<br>
Select privileges were granted on the table<br>
Reading features...<br>
100%<br>
Updating database...<br>
100%<br>
20000 categories read from vector map (layer 1)<br>
20000 categories read from vector map don't exist in selection from
table<br>
20000 records updated/inserted (layer 1)<br>
Current attribute table links:<br>
Vector map <tim_points@PERMANENT> is connected by:<br>
layer <1> table <tim_points> in database
</home/micha/geodata/grass/Tim/PERMANENT/sqlite.db> through
driver <sqlite> with key <cat><br>
<br>
# And use v.to.db to get the coordinate values and elevation into the
table<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > v.to.db tim_points
opt=coor columns="x_coord,y_coord,elev"<br>
Reading features...<br>
100%<br>
Updating database...<br>
100%<br>
20000 categories read from vector map (layer 1)<br>
20000 records selected from table (layer 1)<br>
20000 categories read from vector map exist in selection from table<br>
20000 records updated/inserted (layer 1)<br>
<br>
# Check that the data are there...<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > v.db.select tim_points<br>
cat|x_coord|y_coord|elev<br>
1|674065.186|3367985.593|25.83<br>
2|674066.432|3367982.468|25.96<br>
3|674065.991|3367983.836|40.24<br>
4|674065.926|3367985.701|26<br>
5|674064.648|3367988.887|26.13<br>
6|674067.281|3367992.406|-7.76<br>
....<br>
many more rows <br>
....<br>
19991|674435.808|3368209.515|52.37<br>
19992|674437.288|3368205.84|52.4<br>
19993|674438.758|3368202.2|52.37<br>
19994|674440.229|3368198.532|52.6<br>
19995|674441.661|3368194.951|52.89<br>
19996|674443.096|3368191.339|53.42<br>
19997|674444.717|3368187.573|51.06<br>
19998|674446.147|3368183.988|51.42<br>
19999|674447.273|3368180.722|55.88<br>
20000|674449.021|3368176.826|51.78<br>
GRASS 6.4.0RC6 (Tim):/home/micha/geodata/tmp > <br>
<br>
<br>
HTH<br>
-- <br>
Micha<br>
<br>
<blockquote cite="mid:1300909172463-6201677.post@n2.nabble.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">Another point you might want to take advantage of: v.in.ascii has an
option (-z) to create a 3D vector. This means that each point's geometry
consists of x,y, and z. So you then have the elevation available even if
the values are not actually in the attribute table. For example, you can
interpolate a dem from a 3D vector with no attribute table at all.
</pre>
</blockquote>
<pre wrap=""><!---->
Thank you for the hint, but I used the -z option. I need the elevation in
addition.
Thanks,
Tim
--
View this message in context: <a class="moz-txt-link-freetext" href="http://osgeo-org.1803224.n2.nabble.com/How-to-extract-z-coordiante-and-write-it-into-attribute-table-tp6199821p6201677.html">http://osgeo-org.1803224.n2.nabble.com/How-to-extract-z-coordiante-and-write-it-into-attribute-table-tp6199821p6201677.html</a>
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>
This mail was received via Mail-SeCure System.
</pre>
</blockquote>
<br>
</body>
</html>