<br><br><div class="gmail_quote">On 2 October 2011 19:44, Gery . <span dir="ltr"><<a href="mailto:gamejihou@hotmail.com">gamejihou@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
BTW, this is how I created the "tmpline" table:<br>
<br>
=====<br>
DROP TABLE tmpline;<br>
CREATE TABLE tmpline(<br>
PROFILE VARCHAR(30),<br>
COMMENTS TEXT<br>
);<br>
SELECT AddGeometryColumn('public', 'tmpline', 'geom', 4326, 'LINESTRING', 2);<br>
=====<br>
<br>
and Nicolas the answer to your commentary about if the points are ordered in the CSV file, yes, they are ordered in order to create a straight line (or quasi-straight one) using longitude and latitude, and this is ordered by the ID column. Is it possible to create from scratch a table with correlative ID? I saw the ID serial type, is this the way?<br>

<br>
Thanks,<br>
<div class="im"><br><br></div></blockquote><div><br></div><div>Yes, you can define a table with an SERIAL type, that provides autoincrement feature.</div><div>If the copy operation guarantees that rows in the files are inserted sequentially in the table, then adding a serial column may suffice to build linestrings in the right order (others on the list may confirm that) :</div>
<div><br></div><div>After the "tmp" table is loaded with geometries, alter it to add a serial column:</div><div><br></div><div>alter table tmp add column id serial; </div><div><br></div><div>It will fill the id column with incremented values.</div>
<div>Then create the table that will contain the linestrings:</div><div><br></div><div><div>DROP TABLE tmpline;</div><div>CREATE TABLE tmpline(</div><div>PROFILE VARCHAR(30),</div><div>COMMENTS TEXT</div><div>);</div><div>
SELECT AddGeometryColumn('public', 'tmpline', 'geom', 4326, 'LINESTRING', 2);</div></div><div><br></div><div>Then fill it with linestrings:</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: medium; "><table class="Bs nH iY" cellpadding="0" style="position: relative; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-collapse: collapse; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); width: 1111px; background-position: initial initial; background-repeat: initial initial; ">
<tbody><tr><td class="Bu" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, sans-serif; vertical-align: top; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
<div class="nH if" style="padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; "><div class="nH"><div class="nH hx" style="color: rgb(0, 0, 0); padding-top: 4px; padding-right: 8px; padding-bottom: 4px; padding-left: 8px; ">
<div class="nH"><div class="h7 hn " style="clear: both; padding-bottom: 0px; "><div class="Bk" style="position: relative; margin-bottom: 10px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(239, 239, 239); border-right-color: rgb(239, 239, 239); border-left-color: rgb(239, 239, 239); border-bottom-color: rgb(226, 226, 226); border-top-width: 0px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px; width: 862px; ">
<div class="G3 G2" style="padding-top: 3px; background-color: rgb(255, 255, 255); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-right-color: rgb(188, 188, 188); border-bottom-color: rgb(188, 188, 188); border-left-color: rgb(188, 188, 188); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(188, 188, 188); border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px; ">
<div><div id=":1nh"><div class="HprMsc mNrSre"><div class="gs"><div id=":1nj" class="ii gt" style="font-size: 13px; margin-top: 5px; margin-right: 15px; margin-bottom: 5px; margin-left: 15px; padding-bottom: 20px; position: relative; z-index: 2; ">
<div id=":1ni"> insert into tmpline<br><div class="im" style="color: rgb(102, 102, 102); ">with t as (select * from tmp order by profile, id)<br></div>select profile, st_makeline(geom)<br><div class="im" style="color: rgb(102, 102, 102); ">
from t group by profile;</div></div></div></div></div></div></div></div></div></div></div></div></div></div></td></tr></tbody></table></span></div><div>Check if linestrings are built correctly after this query:</div><div>
<br></div><div>select profile, astext(the_geom) from tmpline;</div><div>After that, you should be able to dump both tables to shapefile, as both contain geometries.</div><div><br></div><div>Nicolas</div><div><br></div></div>