<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" text="#000000"
    bgcolor="#ffffff">
    On 02/04/2012 09:48 AM, Johannes Radinger wrote:
    <blockquote cite="mid:A8B78F65-A35C-4A92-B9E2-532D9BA0B409@gmx.at"
      type="cite">Hi,<br>
      <div>
        <div>Am 03.02.2012 um 17:30 schrieb Micha Silver:</div>
        <br class="Apple-interchange-newline">
        <blockquote type="cite"><span class="Apple-style-span"
            style="border-collapse: separate; font-family: Helvetica;
            font-style: normal; font-variant: normal; font-weight:
            normal; letter-spacing: normal; line-height: normal;
            orphans: 2; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            font-size: medium;">
            <div bidimailui-detected-decoding-type="UTF-8"
              text="#000000" bgcolor="#ffffff" style="direction: ltr;"><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&gt; alter table &lt;your vector&gt; add column
                cat2 integer;<br>
                sqlite&gt; update &lt;your vector&gt; set cat2=CAST(cat
                AS integer);<br>
              </tt></div>
          </span></blockquote>
        <div><br>
        </div>
        Thank you for that, but what should I use to call sqlite
        commands? Can that be done inside GRASS, is there any tool? Or
        should that be&nbsp;</div>
      <div>done from any sqlite-management software or from any command
        line programm (GRASS console? Mac Terminal?)</div>
      <div><br>
      </div>
    </blockquote>
    <br>
    Just run: sqlite3 &lt;your grass sqlite db&gt; from the command
    line, or any of the sqlite management programs. The Mozilla firefox
    sqlite manager is a nice one...<br>
    <blockquote cite="mid:A8B78F65-A35C-4A92-B9E2-532D9BA0B409@gmx.at"
      type="cite">
      <div><br>
        <blockquote type="cite"><span class="Apple-style-span"
            style="border-collapse: separate; font-family: Helvetica;
            font-style: normal; font-variant: normal; font-weight:
            normal; letter-spacing: normal; line-height: normal;
            orphans: 2; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            font-size: medium;">
            <div bidimailui-detected-decoding-type="UTF-8"
              text="#000000" bgcolor="#ffffff" style="direction: ltr;"><tt><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:&nbsp;<br>
                &nbsp;&nbsp;&nbsp; cat double, label text, value double, cat2 integer<br>
                and you want the reordered table to be:&nbsp;<br>
                &nbsp;&nbsp;&nbsp; label, value, cat (the new integer one)<br>
              </tt></div>
          </span></blockquote>
        <div><br>
        </div>
        <div>Of course it is not necessary to change the order for
          database calls etc. It would just be interesting when I look
          into the attribute</div>
        <div>table of a vector within GRASS I have to scroll to the very
          far rigtht side to get to e.g. my vector name label which is
          not that comfortable</div>
        <div>for a quick view... Therefore a quick sort (drag and drop)
          within the GRASS GUI would be of nice but not necessary of
          course...</div>
        <div><br>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    Yes, Moritz explained this quite well with th3 columns="..." option
    to v.db.select.<br>
    <br>
    <blockquote cite="mid:A8B78F65-A35C-4A92-B9E2-532D9BA0B409@gmx.at"
      type="cite">
      <div>
        <blockquote type="cite"><span class="Apple-style-span"
            style="border-collapse: separate; font-family: Helvetica;
            font-style: normal; font-variant: normal; font-weight:
            normal; letter-spacing: normal; line-height: normal;
            orphans: 2; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            font-size: medium;">
            <div bidimailui-detected-decoding-type="UTF-8"
              text="#000000" bgcolor="#ffffff" style="direction: ltr;"><tt><br>
                then:<br>
                <br>
                sqlite&gt; CREATE TABLE tmp (label text, value double,
                cat integer);<br>
                sqlite&gt; INSERT INTO tmp (label, value, cat) SELECT
                label, value, cat2 FROM &lt;your_vector&gt;;<br>
                sqlite&gt; ALTER TABLE &lt;your_vector&gt; RENAME TO
                vector_bak;<br>
                sqlite&gt; ALTER TABLE tmp RENAME TO
                &lt;your_vector&gt;;<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>
              <div style="margin-bottom: 0cm; margin-top: 0pt;"><tt><br>
                </tt></div>
              <tt><br>
              </tt>
              <pre class="moz-signature" cols="72"><tt>-- 
Micha Silver
GIS Consultant, Arava Development Co.
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.surfaces.co.il/">http://www.surfaces.co.il</a></tt></pre>
            </div>
          </span></blockquote>
        <div><span class="Apple-style-span" style="border-collapse:
            separate; font-family: Helvetica; font-style: normal;
            font-variant: normal; font-weight: normal; letter-spacing:
            normal; line-height: normal; orphans: 2; text-indent: 0px;
            text-transform: none; white-space: normal; widows: 2;
            word-spacing: 0px; font-size: medium;">
            <div bidimailui-detected-decoding-type="UTF-8"
              text="#000000" bgcolor="#ffffff" style="direction: ltr;">
              <pre class="moz-signature" cols="72">
</pre>
            </div>
          </span></div>
        <div><span class="Apple-style-span" style="border-collapse:
            separate; font-family: Helvetica; font-style: normal;
            font-variant: normal; font-weight: normal; letter-spacing:
            normal; line-height: normal; orphans: 2; text-indent: 0px;
            text-transform: none; white-space: normal; widows: 2;
            word-spacing: 0px; font-size: medium;"></span></div>
      </div>
      <br>
      <br>
      This mail was received via Mail-SeCure System.<br>
    </blockquote>
    <p><br>
    </p>
    <br>
    <pre class="moz-signature" cols="72">-- 
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></pre>
  </body>
</html>