[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Creating points along a line for every second?
From:       Robert Burgholzer <rburghol () vt ! edu>
Date:       2012-08-31 16:28:51
Message-ID: CACT-NGJrXiGQrxLrFKyiwBOhjDO9fzbdmK9DN3Z307barKFeAA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Very nice when it actually is that simple :).

rb

On Friday, August 31, 2012, James David Smith wrote:

> Hi Robert,
>
> Thanks for your suggestion - this worked great - and was easier than
> learning how to do loops and similar! (though thanks for the
> suggestions from others too!). I knew just a bit of lateral thinking
> was required!
>
> James
>
>
>
> On 17 August 2012 20:48, Robert Burgholzer <rburghol@vt.edu> wrote:
> > If i understand this right, the series field tells you which second in
> total
> > time of N seconds that it took to move along the line. (end_time -
> > start_time)::float should give you the total time in seconds, and
> > series/total_time should give you the parameter that you want for
> > st_line_interpolate_point
> >
> > HTH
> > r.b.
> > On Friday, August 17, 2012, James David Smith wrote:
> >>
> >> Hi everyone,
> >>
> >> I'm flirted around this problem for a while, so I hope I'm not bein
> >> annoying by being repetative, but I've been tearing my hair out trying
> to do
> >> it. The problem is that I have a file of lines (geometry). in a table
> called
> >> temp4 The format of the table is, simplified,
> >>
> >> line
> >> start_time
> >> end_time
> >> series (I generated this as a count of the seconds difference between
> the
> >> above time fields. I thought it would be useful)
> >>
> >> So for example my table (temp4) might look like this:
> >>
> >> line                    ||    start_time           ||  end_time
>  ||
> >> series
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> line_geom         || 12:07:17                || 12:07:20         ||
> >> 3
> >> line_geom         || 12:07:17                || 12:07:20         ||
> >> 2
> >> line_geom         || 12:07:17                || 12:07:20         ||
> >> 1
> >>
> >> line_geom         || 12:07:21                || 12:07:26         ||
> >> 6
> >> line_geom         || 12:07:21                || 12:07:26         ||
> >> 5
> >> line_geom         || 12:07:21                || 12:07:26         ||
> >> 4
> >> line_geom         || 12:07:21                || 12:07:26         ||
> >> 3
> >> line_geom         || 12:07:21                || 12:07:26         ||
> >> 2
> >> line_geom         || 12:07:21                || 12:07:26         ||
> >> 1
> >>
> >>
> >> Now what I want to do is split the lines into points, with a point for
> >> each second. Evenly spaced along the line. So if the line is 10 metres
> long
> >> and the difference between the start and end is 10 seconds then I want
> to
> >> create 9 points at 10% along the line, 20% along the line, 30% along the
> >> line etc up to a point which is 100% along the line i.e. the end of the
> >> line. I don't need a new point at the start of the line as I have that
> >> stored already.
> >>
> >> So I've been trying something like this, but it's wrong. But maybe along
> >> the right lines.
> >>
> >> SELECT st_line_interpolate_point(line, 1/series::float)) as new_point
> >> FROM temp4
> >>
> >> Taking the first few rows of my data, the percentages along the lines I
> >> want to generate are as follows. I need to find a way to get these
> values
> >> into the st_line_interpolate_line  function.
> >>
> >> line                   || start_time             || end_time      ||
> >> series      ||  percentage along line
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> line_geom        || 12:07:17               || 12:07:20      || 3
> >> ||   0.33%
> >> line_geom        || 12:07:17               || 12:07:20      || 2
> >> || > _______________________________________________
> > postgis-users mailing list
> > postgis-users@postgis.refractions.net <javascript:;>
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net <javascript:;>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>


-- 
--
Robert W. Burgholzer
http://www.findingfreestyle.com/
On Facebook -
http://www.facebook.com/pages/Finding-Freestyle/151918511505970
Twitter - http://www.twitter.com/findfreestyle
What's a tweeted swim set? A Sweet? No, a #swaiku!  Get them by following
http://twitter.com/findfreestyle

[Attachment #5 (text/html)]

Very nice when it actually is that simple \
:).<div><br></div><div>rb<span></span><br><br>On Friday, August 31, 2012, James David \
Smith  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi Robert,<br>
<br>
Thanks for your suggestion - this worked great - and was easier than<br>
learning how to do loops and similar! (though thanks for the<br>
suggestions from others too!). I knew just a bit of lateral thinking<br>
was required!<br>
<br>
James<br>
<br>
<br>
<br>
On 17 August 2012 20:48, Robert Burgholzer &lt;<a>rburghol@vt.edu</a>&gt; wrote:<br>
&gt; If i understand this right, the series field tells you which second in total<br>
&gt; time of N seconds that it took to move along the line. (end_time -<br>
&gt; start_time)::float should give you the total time in seconds, and<br>
&gt; series/total_time should give you the parameter that you want for<br>
&gt; st_line_interpolate_point<br>
&gt;<br>
&gt; HTH<br>
&gt; r.b.<br>
&gt; On Friday, August 17, 2012, James David Smith wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi everyone,<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m flirted around this problem for a while, so I hope I&#39;m not \
bein<br> &gt;&gt; annoying by being repetative, but I&#39;ve been tearing my hair out \
trying to do<br> &gt;&gt; it. The problem is that I have a file of lines (geometry). \
in a table called<br> &gt;&gt; temp4 The format of the table is, simplified,<br>
&gt;&gt;<br>
&gt;&gt; line<br>
&gt;&gt; start_time<br>
&gt;&gt; end_time<br>
&gt;&gt; series (I generated this as a count of the seconds difference between \
the<br> &gt;&gt; above time fields. I thought it would be useful)<br>
&gt;&gt;<br>
&gt;&gt; So for example my table (temp4) might look like this:<br>
&gt;&gt;<br>
&gt;&gt; line                    ||    start_time           ||  end_time        \
||<br> &gt;&gt; series<br>
&gt;&gt; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
&gt;&gt; line_geom         || 12:07:17                || 12:07:20         ||<br>
&gt;&gt; 3<br>
&gt;&gt; line_geom         || 12:07:17                || 12:07:20         ||<br>
&gt;&gt; 2<br>
&gt;&gt; line_geom         || 12:07:17                || 12:07:20         ||<br>
&gt;&gt; 1<br>
&gt;&gt;<br>
&gt;&gt; line_geom         || 12:07:21                || 12:07:26         ||<br>
&gt;&gt; 6<br>
&gt;&gt; line_geom         || 12:07:21                || 12:07:26         ||<br>
&gt;&gt; 5<br>
&gt;&gt; line_geom         || 12:07:21                || 12:07:26         ||<br>
&gt;&gt; 4<br>
&gt;&gt; line_geom         || 12:07:21                || 12:07:26         ||<br>
&gt;&gt; 3<br>
&gt;&gt; line_geom         || 12:07:21                || 12:07:26         ||<br>
&gt;&gt; 2<br>
&gt;&gt; line_geom         || 12:07:21                || 12:07:26         ||<br>
&gt;&gt; 1<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Now what I want to do is split the lines into points, with a point for<br>
&gt;&gt; each second. Evenly spaced along the line. So if the line is 10 metres \
long<br> &gt;&gt; and the difference between the start and end is 10 seconds then I \
want to<br> &gt;&gt; create 9 points at 10% along the line, 20% along the line, 30% \
along the<br> &gt;&gt; line etc up to a point which is 100% along the line i.e. the \
end of the<br> &gt;&gt; line. I don&#39;t need a new point at the start of the line \
as I have that<br> &gt;&gt; stored already.<br>
&gt;&gt;<br>
&gt;&gt; So I&#39;ve been trying something like this, but it&#39;s wrong. But maybe \
along<br> &gt;&gt; the right lines.<br>
&gt;&gt;<br>
&gt;&gt; SELECT st_line_interpolate_point(line, 1/series::float)) as new_point<br>
&gt;&gt; FROM temp4<br>
&gt;&gt;<br>
&gt;&gt; Taking the first few rows of my data, the percentages along the lines I<br>
&gt;&gt; want to generate are as follows. I need to find a way to get these \
values<br> &gt;&gt; into the st_line_interpolate_line  function.<br>
&gt;&gt;<br>
&gt;&gt; line                   || start_time             || end_time      ||<br>
&gt;&gt; series      ||  percentage along line<br>
&gt;&gt; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
&gt;&gt; line_geom        || 12:07:17               || 12:07:20      || 3<br>
&gt;&gt; ||   0.33%<br>
&gt;&gt; line_geom        || 12:07:17               || 12:07:20      || 2<br>
&gt;&gt; || &gt; _______________________________________________<br>
&gt; postgis-users mailing list<br>
&gt; <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, \
&#39;postgis-users@postgis.refractions.net&#39;)">postgis-users@postgis.refractions.net</a><br>
 &gt; <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;<br> _______________________________________________<br>
postgis-users mailing list<br>
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, \
&#39;postgis-users@postgis.refractions.net&#39;)">postgis-users@postgis.refractions.net</a><br>
 <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
</blockquote></div><br><br>-- <br>--<br>Robert W. Burgholzer<br><a \
href="http://www.findingfreestyle.com/" \
target="_blank">http://www.findingfreestyle.com/</a><br>On Facebook - <a \
href="http://www.facebook.com/pages/Finding-Freestyle/151918511505970" \
target="_blank">http://www.facebook.com/pages/Finding-Freestyle/151918511505970</a><br>
 Twitter - <a href="http://www.twitter.com/findfreestyle" \
target="_blank">http://www.twitter.com/findfreestyle</a><br>What&#39;s a tweeted swim \
set? A Sweet? No, a #swaiku!  Get them by following <a \
href="http://twitter.com/findfreestyle" \
target="_blank">http://twitter.com/findfreestyle</a><br>



_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic