34#ifndef __MEOS_INTERNAL_GEO_H__
35#define __MEOS_INTERNAL_GEO_H__
40#include <json-c/json.h>
71#define DatumGetGserializedP(X) ((GSERIALIZED *) DatumGetPointer(X))
72#define GserializedPGetDatum(X) PointerGetDatum(X)
78#define LWFLAG_VERSBIT2 0x80
81#define FLAGS_GET_VERSBIT2(flags) (((flags) & LWFLAG_VERSBIT2)>>7)
83#define GS_POINT_PTR(gs) ( (uint8_t *) ((gs)->data) + 8 + \
84 FLAGS_GET_BBOX((gs)->gflags) * FLAGS_NDIMS_BOX((gs)->gflags) * 8 + \
85 FLAGS_GET_VERSBIT2((gs)->gflags) * 8 )
90#define DATUM_POINT2D_P(gs) ( (POINT2D *) GS_POINT_PTR(DatumGetGserializedP(gs)) )
91#define DATUM_POINT3DZ_P(gs) ( (POINT3DZ *) GS_POINT_PTR(DatumGetGserializedP(gs)) )
93#define GSERIALIZED_POINT2D_P(gs) ( (POINT2D *) GS_POINT_PTR((gs)) )
94#define GSERIALIZED_POINT3DZ_P(gs) ( (POINT3DZ *) GS_POINT_PTR((gs)) )
115extern void stbox_set(
bool hasx,
bool hasz,
bool geodetic,
int32 srid,
double xmin,
double xmax,
double ymin,
double ymax,
double zmin,
double zmax,
const Span *s,
STBox *box);
181extern TSequence *
tpointseq_make_coords(
const double *xcoords,
const double *ycoords,
const double *zcoords,
const TimestampTz *times,
int count,
int32 srid,
bool geodetic,
bool lower_inc,
bool upper_inc,
interpType interp,
bool normalize);
STBox * box3d_to_stbox(const BOX3D *box)
Convert a BOX3D into a spatiotemporal box.
Definition: stbox.c:711
void stbox_set(bool hasx, bool hasz, bool geodetic, int32 srid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, const Span *s, STBox *box)
Return in the last argument a spatiotemporal box constructed from the given arguments.
Definition: stbox.c:361
bool geo_set_stbox(const GSERIALIZED *gs, STBox *box)
Return in the last argument the spatiotemporal box of a geometry/geography.
Definition: stbox.c:765
bool spatial_set_stbox(Datum d, meosType basetype, STBox *box)
Return in the last argument a spatiotemporal box constructed from a spatial base value.
Definition: stbox.c:1021
void spatialset_set_stbox(const Set *set, STBox *box)
Return in the last argument the bounding box of a spatial set.
Definition: tspatial.c:392
void gbox_set_stbox(const GBOX *box, int32_t srid, STBox *result)
Set the a spatiotemporal box in the last argument from the GBOX and the SRID.
Definition: stbox.c:666
void tstzspanset_set_stbox(const SpanSet *s, STBox *box)
Return in the last argument a spatiotemporal box constructed from a timestamptz span set.
Definition: stbox.c:980
void tstzset_set_stbox(const Set *s, STBox *box)
Return in the last argument a spatiotemporal box constructed from a timestamptz set.
Definition: stbox.c:910
void geoarr_set_stbox(const Datum *values, int count, STBox *box)
Return in the last argument a spatiotemporal box constructed from an array of geometries/geographies.
Definition: stbox.c:856
void stbox_set_box3d(const STBox *box, BOX3D *box3d)
Return in the last argument a BOX3D constructed from a spatiotemporal box.
Definition: stbox.c:503
void tstzspan_set_stbox(const Span *s, STBox *box)
Return in the last argument a spatiotemporal box constructed from a timestamptz span.
Definition: stbox.c:946
void stbox_set_gbox(const STBox *box, GBOX *gbox)
Return in the last argument a GBOX constructed from a spatiotemporal box.
Definition: stbox.c:474
bool inter_stbox_stbox(const STBox *box1, const STBox *box2, STBox *result)
Return in the last argument the intersection of two spatiotemporal boxes.
Definition: stbox.c:2250
void stbox_expand(const STBox *box1, STBox *box2)
Return the second spatiotemporal box expanded with the first one.
Definition: stbox.c:93
TSequence * tpointseq_cumulative_length(const TSequence *seq, double prevlength)
Return the cumulative length traversed by a temporal point sequence.
Definition: tpoint_spatialfuncs.c:2673
GSERIALIZED * tpointseqset_twcentroid(const TSequenceSet *ss)
Return the time-weighed centroid of a temporal geometry point sequence set.
Definition: tpoint_spatialfuncs.c:2922
GSERIALIZED * tpointseq_linear_trajectory(const TSequence *seq, bool unary_union)
Return the trajectory of a temporal point sequence.
Definition: tpoint_spatialfuncs.c:1149
double tpointseq_length(const TSequence *seq)
Return the length traversed by a temporal point sequence.
Definition: tpoint_spatialfuncs.c:2599
Temporal * tpoint_get_coord(const Temporal *temp, int coord)
Return one of the coordinates of a temporal point as a temporal float.
Definition: tpoint_spatialfuncs.c:164
TSequenceSet * tpointseqset_cumulative_length(const TSequenceSet *ss)
Return the cumulative length traversed by a temporal point sequence set.
Definition: tpoint_spatialfuncs.c:2714
TSequenceSet * tpointseqset_speed(const TSequenceSet *ss)
Return the speed of a temporal point sequence set.
Definition: tpoint_spatialfuncs.c:2808
TSequenceSet * tpointseq_azimuth(const TSequence *seq)
Return the temporal azimuth of a temporal geometry point sequence.
Definition: tpoint_spatialfuncs.c:3174
double tpointseqset_length(const TSequenceSet *ss)
Return the length traversed by a temporal point sequence set.
Definition: tpoint_spatialfuncs.c:2630
bool tpointseq_is_simple(const TSequence *seq)
Return true if a temporal point does not self-intersect.
Definition: tpoint_spatialfuncs.c:4231
bool tpointseqset_is_simple(const TSequenceSet *ss)
Return true if a temporal point does not self-intersect.
Definition: tpoint_spatialfuncs.c:4254
GSERIALIZED * tpointseq_twcentroid(const TSequence *seq)
Return the time-weighed centroid of a temporal geometry point sequence.
Definition: tpoint_spatialfuncs.c:2896
TSequenceSet * tpointseqset_azimuth(const TSequenceSet *ss)
Return the temporal azimuth of a temporal geometry point sequence set.
Definition: tpoint_spatialfuncs.c:3190
TSequence * tpointseq_speed(const TSequence *seq)
Return the speed of a temporal point sequence.
Definition: tpoint_spatialfuncs.c:2766
GSERIALIZED * point_round(const GSERIALIZED *gs, int maxdd)
Return a point with the coordinates set to a number of decimal places.
Definition: geo_round.c:82
void tspatialseqset_set_stbox(const TSequenceSet *ss, STBox *box)
Return in the last argument the spatiotemporal box of a temporal spatial sequence set.
Definition: tgeo_boxops.c:164
void tspatialseq_set_stbox(const TSequence *seq, STBox *box)
Return in the last argument the spatiotemporal box of a temporal spatial sequence.
Definition: tgeo_boxops.c:147
STBox * tgeoseqset_split_n_stboxes(const TSequenceSet *ss, int max_count, int *count)
Return an array of N spatiotemporal boxes from the segments of a temporal geo sequence set.
Definition: tgeo_boxops.c:663
STBox * tgeoseqset_stboxes(const TSequenceSet *ss, int *count)
Return an array of spatiotemporal boxes from the segments of a temporal geo sequence set.
Definition: tgeo_boxops.c:475
STBox * tgeoseq_split_n_stboxes(const TSequence *seq, int max_count, int *count)
Return an array of N spatiotemporal boxes from the instants or segments of a temporal geo sequence,...
Definition: tgeo_boxops.c:634
void tgeoinst_set_stbox(const TInstant *inst, STBox *box)
Return in the last argument the spatiotemporal box of a temporal geo instant.
Definition: tgeo_boxops.c:90
STBox * tgeoseq_stboxes(const TSequence *seq, int *count)
Return an array of spatiotemporal boxes from the instants or segments of a temporal geo sequence,...
Definition: tgeo_boxops.c:449
GSERIALIZED * stbox_geo(const STBox *box)
Return a spatiotemporal box converted as a geometry/geography.
Definition: stbox.c:569
void tspatial_set_stbox(const Temporal *temp, STBox *box)
Return in the last argument the spatiotemporal box of a temporal spatial value.
Definition: tspatial.c:426
TInstant * tgeominst_tgeoginst(const TInstant *inst, bool oper)
Return a temporal geometry/geography transformed from/to a temporal geometry/geography.
Definition: tgeo_spatialfuncs.c:964
Temporal * tgeom_tgeog(const Temporal *temp, bool oper)
Return a temporal geometry/geography transformed from/to a temporal geometry/geography.
Definition: tgeo_spatialfuncs.c:1035
TSequence * tgeomseq_tgeogseq(const TSequence *seq, bool oper)
Return a temporal geometry/geography transformed from/to a temporal geometry/geography.
Definition: tgeo_spatialfuncs.c:991
Temporal * tgeo_tpoint(const Temporal *temp, bool oper)
Return a temporal geo transformed from/to a temporal point.
Definition: tgeo_spatialfuncs.c:1235
TSequenceSet * tgeomseqset_tgeogseqset(const TSequenceSet *ss, bool oper)
Return a temporal geometry/geography transformed from/to a temporal geometry/geography.
Definition: tgeo_spatialfuncs.c:1011
TInstant * tgeogpointinst_from_mfjson(json_object *mfjson, int32_t srid)
Return a temporal geography point instant from its MF-JSON representation.
Definition: tgeo_meos.c:289
TSequence * tgeompointseq_in(const char *str, interpType interp)
Return a temporal geometry point sequence from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:128
TSequence * tgeographyseq_in(const char *str, interpType interp)
Return a temporal geography sequence from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:185
TInstant * tgeogpointinst_in(const char *str)
Return a temporal instant geography point from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:77
TSequence * tgeographyseq_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geography sequence from its MF-JSON representation.
Definition: tgeo_meos.c:375
TSequence * tgeogpointseq_in(const char *str, interpType interp)
Return a temporal geography point sequence from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:147
TSequenceSet * tgeographyseqset_in(const char *str)
Return a temporal geography sequence set from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:253
TSequence * tgeompointseq_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geometry point sequence from its MF-JSON representation.
Definition: tgeo_meos.c:332
TInstant * tgeompointinst_from_mfjson(json_object *mfjson, int32_t srid)
Return a temporal geometry point instant from its MF-JSON representation.
Definition: tgeo_meos.c:275
TInstant * tgeometryinst_from_mfjson(json_object *mfjson, int32_t srid)
Return a temporal geometry instant from its MF-JSON representation.
Definition: tgeo_meos.c:302
TSequence * tgeogpointseq_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geography point sequence from its MF-JSON representation.
Definition: tgeo_meos.c:347
TInstant * tgeompointinst_in(const char *str)
Return a temporal geometry point instant from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:61
TSequenceSet * tgeompointseqset_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geometry point sequence set from its MF-JSON representation.
Definition: tgeo_meos.c:392
TSequence * tgeometryseq_in(const char *str, interpType interp)
Return a temporal geometry sequence from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:166
TSequenceSet * tgeometryseqset_in(const char *str)
Return a temporal geometry sequence set from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:237
TSequenceSet * tgeogpointseqset_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geography point sequence set from its MF-JSON representation.
Definition: tgeo_meos.c:407
TInstant * tgeometryinst_in(const char *str)
Return a temporal geometry instant from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:93
TSequence * tgeometryseq_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geometry sequence from its MF-JSON representation.
Definition: tgeo_meos.c:361
TSequenceSet * tgeographyseqset_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geography sequence set from its MF-JSON representation.
Definition: tgeo_meos.c:437
TSequenceSet * tgeometryseqset_from_mfjson(json_object *mfjson, int32_t srid, interpType interp)
Return a temporal geometry sequence set from its MF-JSON representation.
Definition: tgeo_meos.c:422
TSequenceSet * tgeogpointseqset_in(const char *str)
Return a temporal geography point sequence set from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:221
TSequenceSet * tgeompointseqset_in(const char *str)
Return a temporal geometry point sequence set from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:205
TInstant * tgeographyinst_from_mfjson(json_object *mfjson, int32_t srid)
Return a temporal geography instant from its MF-JSON representation.
Definition: tgeo_meos.c:315
TInstant * tgeographyinst_in(const char *str)
Return a temporal geography instant from its Well-Known Text (WKT) representation.
Definition: tgeo_meos.c:109
Temporal * tgeo_restrict_stbox(const Temporal *temp, const STBox *box, bool border_inc, bool atfunc)
Return a temporal geo restricted to (the complement of) a spatiotemporal box.
Definition: tgeo_restrict.c:1111
Temporal * tgeo_restrict_geom(const Temporal *temp, const GSERIALIZED *gs, const Span *zspan, bool atfunc)
Return a temporal geo restricted to (the complement of) a geometry and possibly a Z span.
Definition: tgeo_restrict.c:2045
TInstant * tgeoinst_restrict_stbox(const TInstant *inst, const STBox *box, bool border_inc, bool atfunc)
Return a temporal geo instant restricted to (the complement of) a spatiotemporal box.
Definition: tgeo_restrict.c:599
TSequenceSet * tgeoseqset_restrict_stbox(const TSequenceSet *ss, const STBox *box, bool border_inc, bool atfunc)
Return a temporal geo sequence set restricted to (the complement of) a spatiotemporal box.
Definition: tgeo_restrict.c:1057
Temporal * tgeoseq_restrict_geom(const TSequence *seq, const GSERIALIZED *gs, const Span *zspan, bool atfunc)
Return a temporal geo sequence restricted to (the complement of) a geometry and possibly a Z span and...
Definition: tgeo_restrict.c:1944
TInstant * tgeoinst_restrict_geom(const TInstant *inst, const GSERIALIZED *gs, const Span *zspan, bool atfunc)
Return a temporal geo instant restricted to (the complement of) a geometry and possibly a Z span and ...
Definition: tgeo_restrict.c:1477
TSequenceSet * tgeoseqset_restrict_geom(const TSequenceSet *ss, const GSERIALIZED *gs, const Span *zspan, bool atfunc)
Return a temporal geo sequence set restricted to (the complement of) a geometry and possibly a Z span...
Definition: tgeo_restrict.c:1991
Temporal * tgeoseq_restrict_stbox(const TSequence *seq, const STBox *box, bool border_inc, bool atfunc)
Return a temporal geo sequence restricted to (the complement of) a spatiotemporal box.
Definition: tgeo_restrict.c:1005
int tspatialinst_srid(const TInstant *inst)
Return the SRID of a spatiotemporal instant.
Definition: tspatial_srid.c:200
void tspatialseqset_set_srid(TSequenceSet *ss, int32_t srid)
Set the coordinates of a spatiotemporal sequence set to an SRID.
Definition: tspatial_srid.c:277
void tspatialseq_set_srid(TSequence *seq, int32_t srid)
Set the coordinates of a spatiotemporal sequence to an SRID.
Definition: tspatial_srid.c:258
void tspatialinst_set_srid(TInstant *inst, int32_t srid)
Set the coordinates of a spatiotemporal instant to an SRID.
Definition: tspatial_srid.c:243
TSequence ** tpointseq_make_simple(const TSequence *seq, int *count)
Return a temporal point sequence split into an array of non self-intersecting fragments.
Definition: tpoint_spatialfuncs.c:4404
TSequence ** tpointseqset_make_simple(const TSequenceSet *ss, int *count)
Return a temporal point sequence set split into an array of non self-intersecting fragments.
Definition: tpoint_spatialfuncs.c:4449
TSequence * tpointseq_make_coords(const double *xcoords, const double *ycoords, const double *zcoords, const TimestampTz *times, int count, int32 srid, bool geodetic, bool lower_inc, bool upper_inc, interpType interp, bool normalize)
Return a temporal sequence from arrays of coordinates, one per dimension, and timestamps.
Definition: tsequence.c:1242
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:55
set(CBUFFER_SRCS cbuffer.c tcbuffer.c tcbuffer_boxops.c tcbuffer_compops.c tcbuffer_distance.c tcbuffer_spatialfuncs.c tcbuffer_spatialrels.c tcbuffer_tempspatialrels.c) if(1) list(APPEND CBUFFER_SRCS cbufferset_meos.c) endif() add_library(cbuffer OBJECT $
Definition: CMakeLists.txt:1
interpType
Enumeration that defines the interpolation types used in MEOS.
Definition: meos.h:161
External API of the Mobility Engine Open Source (MEOS) library.
int32_t spatial_srid(Datum d, meosType basetype)
Return the SRID of a spatial value.
Definition: tspatial_srid.c:81
Datum datum_geo_round(Datum value, Datum size)
Return a geometry with the precision of the coordinates set to a number of decimal places.
Definition: geo_round.c:579
bool spatial_set_srid(Datum d, meosType basetype, int32_t srid)
Return true if the first argument has been successfully transformed to another SRID.
Definition: tspatial_srid.c:113
PJ_CONTEXT * proj_get_context(void)
Get the random generator used by temporal aggregation.
Definition: meos.c:146
int64 TimestampTz
Definition: postgres_ext_defs.in.h:22
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
signed int int32
Definition: postgres_ext_defs.in.h:11
Definition: postgis_ext_defs.in.h:65
Definition: postgis_ext_defs.in.h:79
Definition: postgis_ext_defs.in.h:170
Structure to represent spatiotemporal boxes.
Definition: meos.h:134
Structure to represent sets of values.
Definition: meos.h:80
Structure to represent span sets.
Definition: meos.h:108
Structure to represent spans (a.k.a.
Definition: meos.h:94
Structure to represent temporal values of instant subtype.
Definition: meos.h:185
Structure to represent temporal values of sequence set subtype.
Definition: meos.h:224
Structure to represent temporal values of sequence subtype.
Definition: meos.h:202
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:173
int const GSERIALIZED * gs
Definition: trgeo_spatialrels.h:52