MobilityDB  1.0
Macros | Functions
tpoint_analytics.c File Reference

Analytic functions for temporal points and temporal floats. More...

#include "point/tpoint_analytics.h"
#include <assert.h>
#include <float.h>
#include <funcapi.h>
#include <math.h>
#include <access/htup_details.h>
#include <utils/builtins.h>
#include <utils/timestamp.h>
#include "general/period.h"
#include "general/periodset.h"
#include "general/timeops.h"
#include "general/temporaltypes.h"
#include "general/tempcache.h"
#include "general/temporal_util.h"
#include "general/lifting.h"
#include "general/tnumber_mathfuncs.h"
#include "point/postgis.h"
#include "point/geography_funcs.h"
#include "point/tpoint.h"
#include "point/tpoint_boxops.h"
#include "point/tpoint_spatialrels.h"
#include "point/tpoint_spatialfuncs.h"
Include dependency graph for tpoint_analytics.c:

Macros

#define DELTA_UNIX_POSTGRES_EPOCH   946684800
 

Functions

static LWPOINT * point_to_trajpoint (Datum point, TimestampTz t)
 Converts the point and the timestamp into a PostGIS geometry/geography point where the M coordinate encodes the timestamp in Unix epoch. More...
 
static Datum tpointinst_to_geo (const TInstant *inst)
 Converts the temporal instant point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static Datum tpointinstset_to_geo (const TInstantSet *ti)
 Converts the temporal instant set point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static LWGEOM * tpointseq_to_geo1 (const TSequence *seq)
 Converts the temporal sequence point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static Datum tpointseq_to_geo (const TSequence *seq)
 Converts the temporal sequence point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static Datum tpointseqset_to_geo (const TSequenceSet *ts)
 Converts the temporal sequence set point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static int tpointseq_to_geo_segmentize1 (LWGEOM **result, const TSequence *seq)
 Converts the temporal sequence point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static Datum tpointseq_to_geo_segmentize (const TSequence *seq)
 Converts the temporal sequence point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
static Datum tpointseqset_to_geo_segmentize (const TSequenceSet *ts)
 Converts the temporal sequence set point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch. More...
 
PGDLLEXPORT Datum tpoint_to_geo (PG_FUNCTION_ARGS)
 Converts the temporal point into a PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in number of seconds since '1970-01-01'. More...
 
static TInstanttrajpoint_to_tpointinst (LWPOINT *lwpoint)
 Converts the PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch into a temporal instant point. More...
 
static TInstantgeo_to_tpointinst (GSERIALIZED *gs)
 Converts the PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch into a temporal instant point. More...
 
static TInstantSetgeo_to_tpointinstset (GSERIALIZED *gs)
 Converts the PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch into a temporal instant set point. More...
 
static TSequencegeo_to_tpointseq (GSERIALIZED *gs)
 Converts the PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch into a temporal sequence point. More...
 
static TSequenceSetgeo_to_tpointseqset (GSERIALIZED *gs)
 Converts the PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch into a temporal sequence set point. More...
 
PGDLLEXPORT Datum geo_to_tpoint (PG_FUNCTION_ARGS)
 Converts the PostGIS trajectory geometry/geography where the M coordinates encode the timestamps in Unix epoch into a temporal point. More...
 
static LWPOINT * point_measure_to_geo_measure (Datum point, Datum measure)
 
static Datum tpointinst_to_geo_measure (const TInstant *inst, const TInstant *measure)
 Construct a geometry/geography with M measure from the temporal instant point and the temporal float. More...
 
static Datum tpointinstset_to_geo_measure (const TInstantSet *ti, const TInstantSet *measure)
 Construct a geometry/geography with M measure from the temporal instant set point and the temporal float. More...
 
static LWGEOM * tpointseq_to_geo_measure1 (const TSequence *seq, const TSequence *measure)
 Construct a geometry/geography with M measure from the temporal sequence point and the temporal float. More...
 
static Datum tpointseq_to_geo_measure (const TSequence *seq, const TSequence *measure)
 Construct a geometry/geography with M measure from the temporal sequence point and the temporal float. More...
 
static Datum tpointseqset_to_geo_measure (const TSequenceSet *ts, const TSequenceSet *measure)
 Construct a geometry/geography with M measure from the temporal sequence point and the temporal float. More...
 
static int tpointseq_to_geo_measure_segmentize1 (LWGEOM **result, const TSequence *seq, const TSequence *measure)
 Construct a geometry/geography with M measure from the temporal sequence point and the temporal float. More...
 
static Datum tpointseq_to_geo_measure_segmentize (const TSequence *seq, const TSequence *measure)
 Construct a geometry/geography with M measure from the temporal sequence point and the temporal float. More...
 
static Datum tpointseqset_to_geo_measure_segmentize (const TSequenceSet *ts, const TSequenceSet *measure)
 Construct a geometry/geography with M measure from the temporal sequence set point and the temporal float. More...
 
PGDLLEXPORT Datum tpoint_to_geo_measure (PG_FUNCTION_ARGS)
 Construct a geometry/geography with M measure from the temporal point and the temporal float. More...
 
static void tfloatseq_dp_findsplit (const TSequence *seq, int i1, int i2, int *split, double *dist)
 Finds a split when simplifying the temporal sequence point using a spatio-temporal extension of the Douglas-Peucker line simplification algorithm. More...
 
int int_cmp (const void *a, const void *b)
 Returns a negative or a positive value depending on whether the first number is less than or greater than the second one. More...
 
TSequencetfloatseq_simplify (const TSequence *seq, double eps_dist, uint32_t minpts)
 Simplifies the temporal sequence number using a Douglas-Peucker-like line simplification algorithm. More...
 
TSequenceSettfloatseqset_simplify (const TSequenceSet *ts, double eps_dist, uint32_t minpts)
 Simplifies the temporal sequence set number using a Douglas-Peucker-like line simplification algorithm. More...
 
Datum tfloat_simplify (PG_FUNCTION_ARGS)
 Simplifies the temporal number using a Douglas-Peucker-like line simplification algorithm. More...
 
static double tpointinst_speed (const TInstant *inst1, const TInstant *inst2, datum_func2 func)
 Returns the speed of the temporal point in the segment. More...
 
double dist2d_pt_pt (POINT2D *p1, POINT2D *p2)
 Returns the 2D distance between the points. More...
 
double dist3d_pt_pt (POINT3DZ *p1, POINT3DZ *p2)
 Returns the 3D distance between the points. More...
 
double dist4d_pt_pt (POINT4D *p1, POINT4D *p2)
 Returns the 4D distance between the points. More...
 
double dist2d_pt_seg (POINT2D *p, POINT2D *A, POINT2D *B)
 Returns the 2D distance between the point the segment. More...
 
double dist3d_pt_seg (POINT3DZ *p, POINT3DZ *A, POINT3DZ *B)
 Returns the 3D distance between the point the segment. More...
 
double dist4d_pt_seg (POINT4D *p, POINT4D *A, POINT4D *B)
 Returns the 4D distance between the point the segment. More...
 
static void tpointseq_dp_findsplit (const TSequence *seq, int i1, int i2, bool withspeed, int *split, double *dist, double *delta_speed)
 Finds a split when simplifying the temporal sequence point using a spatio-temporal extension of the Douglas-Peucker line simplification algorithm. More...
 
TSequencetpointseq_simplify (const TSequence *seq, double eps_dist, double eps_speed, uint32_t minpts)
 Simplifies the temporal sequence point using a spatio-temporal extension of the Douglas-Peucker line simplification algorithm. More...
 
TSequenceSettpointseqset_simplify (const TSequenceSet *ts, double eps_dist, double eps_speed, uint32_t minpts)
 Simplifies the temporal sequence set point using a spatio-temporal extension of the Douglas-Peucker line simplification algorithm. More...
 
Temporaltpoint_simplify_internal (Temporal *temp, double eps_dist, double eps_speed)
 
Datum tpoint_simplify (PG_FUNCTION_ARGS)
 Simplifies the temporal sequence (set) point using a spatio-temporal extension of the Douglas-Peucker line simplification algorithm. More...
 
TInstantSettpointinstset_remove_repeated_points (const TInstantSet *ti, double tolerance, int min_points)
 Returns a temporal point with consecutive equal points removed. More...
 
TSequencetpointseq_remove_repeated_points (const TSequence *seq, double tolerance, int min_points)
 Returns a temporal point with consecutive equal points removed. More...
 
TSequenceSettpointseqset_remove_repeated_points (const TSequenceSet *ts, double tolerance, int min_points)
 Returns a temporal point with consecutive equal points removed. More...
 
Temporaltpoint_remove_repeated_points (const Temporal *temp, double tolerance, int min_points)
 Returns a temporal point with consecutive equal points removed. More...
 
void tpointinst_affine_iterator (TInstant **result, const TInstant *inst, const AFFINE *a, int srid, bool hasz)
 Affine transform a temporal point (iterator function) More...
 
TInstanttpointinst_affine (const TInstant *inst, const AFFINE *a)
 Affine transform a temporal point. More...
 
TInstantSettpointinstset_affine (const TInstantSet *ti, const AFFINE *a)
 Affine transform a temporal point. More...
 
TSequencetpointseq_affine (const TSequence *seq, const AFFINE *a)
 Affine transform a temporal point. More...
 
TSequenceSettpointseqset_affine (const TSequenceSet *ts, const AFFINE *a)
 Affine transform a temporal point. More...
 
Temporaltpoint_affine (const Temporal *temp, const AFFINE *a)
 Affine transform a temporal point. More...
 
TInstanttpointinst_grid (const TInstant *inst, const gridspec *grid)
 Stick a temporal point to the given grid specification. More...
 
TInstantSettpointinstset_grid (const TInstantSet *ti, const gridspec *grid)
 Stick a temporal point to the given grid specification. More...
 
TSequencetpointseq_grid (const TSequence *seq, const gridspec *grid, bool filter_pts)
 Stick a temporal point to the given grid specification. More...
 
TSequenceSettpointseqset_grid (const TSequenceSet *ts, const gridspec *grid, bool filter_pts)
 Stick a temporal point to the given grid specification. More...
 
Temporaltpoint_grid (const Temporal *temp, const gridspec *grid, bool filter_pts)
 Stick a temporal point to the given grid specification. More...
 
Temporaltpoint_mvt (const Temporal *tpoint, const STBOX *box, uint32_t extent, uint32_t buffer, bool clip_geom)
 Transform a temporal point into vector tile coordinate space. More...
 
Datum tpointinst_decouple (const TInstant *inst, ArrayType **timesarr)
 Decouple the points and the timestamps of a temporal point. More...
 
Datum tpointinstset_decouple (const TInstantSet *ti, ArrayType **timesarr)
 Decouple the points and the timestamps of a temporal point. More...
 
LWGEOM * tpointseq_decouple1 (const TSequence *seq, Datum *times)
 Decouple the points and the timestamps of a temporal point. More...
 
Datum tpointseq_decouple (const TSequence *seq, ArrayType **timesarr)
 Decouple the points and the timestamps of a temporal point. More...
 
Datum tpointseqset_decouple (const TSequenceSet *ts, ArrayType **timesarr)
 Decouple the points and the timestamps of a temporal point. More...
 
Datum tpoint_decouple (const Temporal *temp, ArrayType **timesarr)
 Decouple the points and the timestamps of a temporal point. More...
 
Datum AsMVTGeom (PG_FUNCTION_ARGS)
 Transform the temporal point to Mapbox Vector Tile format. More...
 

Detailed Description

Analytic functions for temporal points and temporal floats.