<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
<style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="UTF-8" text="#000000"
bgcolor="#ffffff">
<tt>On 02/03/2012 01:57 PM, Johannes Radinger wrote:</tt>
<blockquote cite="mid:20120203115723.291550@gmx.net" type="cite">
<pre wrap=""><tt>Hello,
While working on a vectorfile (lines) with 46000 entries in sqlite in GRASS
some questions popped up:
1) Somehow my cat column is double precision instead of integer...Can it be transformed into an integer within GRASS GIS to do some v.select operations with it? If yes, how exactly?
</tt></pre>
</blockquote>
<tt><br>
Converting the values to integer can be done with the sqlite
CAST(cat AS integer). But that probably won't help. THe column
itself needs to be integer type, so I think you need to make a new
cat column and populate it with integer values:<br>
Using sqlite:<br>
sqlite> alter table <your vector> add column cat2
integer;<br>
sqlite> update <your vector> set cat2=CAST(cat AS
integer);<br>
<br>
</tt>
<blockquote cite="mid:20120203115723.291550@gmx.net" type="cite">
<pre wrap=""><tt>
2) Is it possible to change the order of the columns in the attribute table?
</tt></pre>
</blockquote>
<tt><br>
In sqlite you can't change the order of the columns, so you'll
need to create a new table ordered the way you want, then juggle
the table names so that the grass vector "sees" the new reordered
table.<br>
Suppose, after the first question above you have a vector with
columns: <br>
cat double, label text, value double, cat2 integer<br>
and you want the reordered table to be: <br>
label, value, cat (the new integer one)<br>
<br>
then:<br>
<br>
sqlite> CREATE TABLE tmp (label text, value double, cat
integer);<br>
sqlite> INSERT INTO tmp (label, value, cat) SELECT label,
value, cat2 FROM <your_vector>;<br>
sqlite> ALTER TABLE <your_vector> RENAME TO vector_bak;<br>
sqlite> ALTER TABLE tmp RENAME TO <your_vector>;<br>
<br>
HTH,<br>
Micha<br>
<br>
</tt>
<blockquote cite="mid:20120203115723.291550@gmx.net" type="cite">
<pre wrap=""><tt>
I am working on GRASS GIS 6.5SVN on Mac OSX.
Best regards,
Johannes
</tt></pre>
</blockquote>
<p><tt><br>
</tt></p>
<tt><br>
</tt>
<pre class="moz-signature" cols="72"><tt>--
Micha Silver
GIS Consultant, Arava Development Co.
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></tt></pre>
</body>
</html>