<div dir="ltr"><div dir="ltr"><div>Dear Alan<div><div id="gmail-yiv9968452757ydp27fbeb66yiv1353059539"><div dir="ltr"><div><br clear="none"></div><div dir="ltr">I am adding the mailing list <a rel="nofollow noopener noreferrer" shape="rect" class="gmail-yiv9968452757" target="_blank" href="http://lists.osgeo.org/mailman/listinfo/mobilitydb-users">http://lists.osgeo.org/mailman/listinfo/mobilitydb-users</a>, so the discussion is also available to the community. You are welcome to subscribe and post questions there.<br></div><div dir="ltr"><br></div><div>I understand that you got a sequence of (location, timestamp) pairs, from which you want to construct a trajectory. But you want to split into multiple trajectories whenever there is a big gap (in time or in distance) between two consecutive points.<br> </div><div dir="ltr"><br clear="none"></div>Enclosed is an SQL function to do this. <br><div><br clear="none"></div><div>The
 function takes an array of points and an array of timestamps as the 
first two parameters (they should be in the same order). The last two 
parameters are a distance and an interval thresholds (which are 
application dependent) for deciding whether two consecutive observations
 belong to the same trip or not. The function produces a 
sequenceset object which is a trajectory possibly with multiple gaps. If
 you prefer to have them separate you can break the sequenceset into 
multiple sequence by applying the functions unnest(sequences(.)).</div><div dir="ltr"><br clear="none"></div><div dir="ltr">An example to call this function would be like this:</div><div dir="ltr"><div><div dir="ltr"><span><br clear="none"></span></div><div dir="ltr"><span>SELECT MMSI, build_tgeompoints(array_agg( Geom ORDER BY T), array_agg( T ORDER BY T), 100, '5 minutes'::interval) Trip    <br clear="none"></span></div><div dir="ltr"><span>FROM IoTBatchInput     <br clear="none"></span></div><span>GROUP BY IoTSource;</span></div><div><br clear="none"></div></div><div>I hope this will help.<br></div><div dir="ltr"><br clear="none"><div>Mahmoud <br></div></div></div></div></div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 31, 2021 at 3:38 PM Alan Suc <<a href="mailto:suc.eleve@ecole-navale.fr">suc.eleve@ecole-navale.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Sorry to bother you again but I would like to know if there is a way to <br>
sequence a temporal object regarding, like a trajectory if there is too <br>
much time between two individual points. For example if the object goes <br>
out of the area considered and come back inside few moment later, how to <br>
sequence the trajectory regarding these two phases ?<br>
<br>
Thanks again for your support.<br>
<br>
Best Regards,<br>
<br>
A. Suc<br>
</blockquote></div></div>