<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>> Hello Esteban,<div><br></div><div>> Is there a complete list of PostGIS functions you are using?</div></div><div><br></div>The PostGIS functions that we use are<br>* those in liblwgeom.h<br>* those stated in the postgis.h file<br><a href="https://github.com/MobilityDB/MobilityDB/blob/develop/point/include/postgis.h">https://github.com/MobilityDB/MobilityDB/blob/develop/point/include/postgis.h</a><br><br>However, the issue is that we call the functions defined in liblwgeom.h directly in order to increase performance. Indeed, a first version of MobilityDB called PostGIS functions through SQL but the performance was unacceptable and therefore we access directly the GSERIALIZED, LWPOINT, POINT2D, etc. structures defined by PostGIS.<br><br>For example, we need to compute the temporal azimuth for a trip which typically has 10K points. We have to do this for thousands of trips. The function for doing this (somehow simplified) is as follows<br><br>/**<br> * Returns the azimuth of the two geometry points<br> */<br>static Datum<br>geom_azimuth(Datum geom1, Datum geom2)<br>{<br>  const POINT2D *p1 = datum_get_point2d_p(geom1);<br>  const POINT2D *p2 = datum_get_point2d_p(geom2);<br>  double result;<br>  azimuth_pt_pt(p1, p2, &result); <---- function defined in liblwgeom.h<br>  return Float8GetDatum(result);<br>}<br><br>static int<br>tpointseq_azimuth1(TSequence **result, const TSequence *seq)<br>{<br>  [...]<br><br>  const TInstant *inst1 = tsequence_inst_n(seq, 0);<br>  Datum value1 = tinstant_value(inst1);<br>  int k = 0;<br>  for (int i = 1; i < seq->count; i++)<br>  {<br>    const TInstant *inst2 = tsequence_inst_n(seq, i);<br>    Datum value2 = tinstant_value(inst2);<br>    if (datum_ne(value1, value2, seq->basetypid))<br>    {<br>      Datum azimuth = geom_azimuth(value1, value2);<br>      instants[k++] = tinstant_make(azimuth, inst1->t, FLOAT8OID);<br>    }<br>    else<br>    {<br>      [...]<br>    }<br>    inst1 = inst2;<br>    value1 = value2;<br>  }<br>  [...]<br>}<br><br>Many thanks for your help !<br><br>Esteban<br></div>