MobilityDB 1.3
Loading...
Searching...
No Matches
Functions
tgeo_spatialfuncs.c File Reference

Spatial functions for temporal geos. More...

#include "geo/tgeo_spatialfuncs.h"
#include <utils/float.h>
#include <liblwgeom.h>
#include <liblwgeom_internal.h>
#include <lwgeom_log.h>
#include <lwgeodetic.h>
#include <lwgeom_geos.h>
#include <meos.h>
#include <meos_geo.h>
#include <meos_internal.h>
#include <meos_internal_geo.h>
#include "temporal/postgres_types.h"
#include "temporal/lifting.h"
#include "temporal/temporal.h"
#include "temporal/temporal_compops.h"
#include "temporal/tnumber_mathfuncs.h"
#include "temporal/tsequence.h"
#include "temporal/type_util.h"
#include "geo/postgis_funcs.h"
#include "geo/stbox.h"
#include "geo/tgeo.h"
#include "geo/tgeo_distance.h"

Functions

Datum datum2_geog_centroid (Datum geo)
 Return the centroid of a geography. More...
 
Datum datum2_geom_centroid (Datum geo)
 Return the centroid of a geometry. More...
 
Datum datum2_point_eq (Datum point1, Datum point2)
 Return true if the points are equal. More...
 
Datum datum_geog_distance (Datum geog1, Datum geog2)
 Return the distance between the two geographies. More...
 
Datum datum_geom_distance2d (Datum geom1, Datum geom2)
 Return the 2D distance between the two geometries. More...
 
Datum datum_geom_distance3d (Datum geom1, Datum geom2)
 Return the 3D distance between the two geometries. More...
 
void datum_point4d (Datum value, POINT4D *p)
 Return a 4D point from a datum. More...
 
bool datum_point_eq (Datum point1, Datum point2)
 Return true if the points are equal. More...
 
bool datum_point_same (Datum point1, Datum point2)
 Return true if the points are equal taking into account floating point imprecision. More...
 
Datum datum_pt_distance2d (Datum geom1, Datum geom2)
 Return the 2D distance between the two geometry points. More...
 
Datum datum_pt_distance3d (Datum geom1, Datum geom2)
 Return the 3D distance between the two geometry points. More...
 
bool ensure_has_M_geo (const GSERIALIZED *gs)
 Ensure that the geometry/geography has M dimension. More...
 
bool ensure_has_not_M_geo (const GSERIALIZED *gs)
 Ensure that the geometry/geography has not M dimension. More...
 
bool ensure_has_not_Z_geo (const GSERIALIZED *gs)
 Ensure that the geometry/geography has not Z dimension. More...
 
bool ensure_has_Z_geo (const GSERIALIZED *gs)
 Ensure that the geometry/geography has not Z dimension. More...
 
bool ensure_mline_type (const GSERIALIZED *gs)
 Ensure that the geometry/geography is a (multi)line. More...
 
bool ensure_not_empty (const GSERIALIZED *gs)
 Ensure that the geometry/geography is not empty. More...
 
bool ensure_not_geodetic (int16 flags)
 Ensure that the spatiotemporal argument has planar coordinates. More...
 
bool ensure_not_geodetic_geo (const GSERIALIZED *gs)
 Ensure that the geometry has planar coordinates. More...
 
bool ensure_point_type (const GSERIALIZED *gs)
 Ensure that the geometry/geography is a point. More...
 
bool ensure_same_dimensionality (int16 flags1, int16 flags2)
 Ensure that two temporal points have the same dimensionality as given by their flags. More...
 
bool ensure_same_dimensionality_geo (const GSERIALIZED *gs1, const GSERIALIZED *gs2)
 Ensure that two geometries/geographies have the same dimensionality. More...
 
bool ensure_same_dimensionality_tspatial_geo (const Temporal *temp, const GSERIALIZED *gs)
 Ensure that a spatiotemporal value and a geometry/geography have the same dimensionality. More...
 
bool ensure_same_geodetic (int16 flags1, int16 flags2)
 Ensure that the spatiotemporal argument have the same type of coordinates, either planar or geodetic. More...
 
bool ensure_same_geodetic_geo (const GSERIALIZED *gs1, const GSERIALIZED *gs2)
 Ensure that two geometries/geographies have the same dimensionality. More...
 
bool ensure_same_geodetic_stbox_geo (const STBox *box, const GSERIALIZED *gs)
 Ensure that a spatiotemporal box and a geometry/geography have both planar or geodetic coordinates. More...
 
bool ensure_same_geodetic_tspatial_base (const Temporal *temp, Datum base)
 Ensure that the spatiotemporal argument and the geometry/geography have the same type of coordinates, either planar or geodetic. More...
 
bool ensure_same_geodetic_tspatial_geo (const Temporal *temp, const GSERIALIZED *gs)
 Ensure that the spatiotemporal argument and the geometry/geography have the same type of coordinates, either planar or geodetic. More...
 
bool ensure_same_spatial_dimensionality (int16 flags1, int16 flags2)
 Ensure that two temporal points have the same spatial dimensionality as given by their flags. More...
 
bool ensure_same_spatial_dimensionality_stbox_geo (const STBox *box, const GSERIALIZED *gs)
 Ensure that a spatiotemporal box and a geometry/geography have the same spatial dimensionality. More...
 
bool ensure_same_srid (int32_t srid1, int32_t srid2)
 Ensure that the two spatial objects have the same SRID. More...
 
bool ensure_spatial_validity (const Temporal *temp1, const Temporal *temp2)
 Ensure that the spatial constraints required for operating on two temporal geometries are satisfied. More...
 
bool ensure_srid_known (int32_t srid)
 Ensure that the SRID is known. More...
 
bool ensure_tgeo_point_type (const Temporal *temp)
 Ensure that all geometries composing a temporal geo are points. More...
 
bool ensure_tgeoinst_point_type (const TInstant *inst)
 Ensure that all geometries composing a temporal geo are points. More...
 
bool ensure_tgeoseq_point_type (const TSequence *seq)
 Ensure that all geometries composing a temporal geo are points. More...
 
bool ensure_tgeoseqset_point_type (const TSequenceSet *ss)
 Ensure that all geometries composing a temporal geo are points. More...
 
bool ensure_valid_spatial_stbox_stbox (const STBox *box1, const STBox *box2)
 Ensure the validity of a spatiotemporal boxes. More...
 
bool ensure_valid_stbox_geo (const STBox *box, const GSERIALIZED *gs)
 Ensure the validity of a spatiotemporal box and a geometry. More...
 
bool ensure_valid_tgeo_geo (const Temporal *temp, const GSERIALIZED *gs)
 Ensure the validity of a temporal geo and a spatiotemporal box. More...
 
bool ensure_valid_tgeo_stbox (const Temporal *temp, const STBox *box)
 Ensure the validity of a temporal geo and a spatiotemporal box. More...
 
bool ensure_valid_tgeo_tgeo (const Temporal *temp1, const Temporal *temp2)
 Ensure the validity of two temporal geos. More...
 
bool ensure_valid_tspatial_base (const Temporal *temp, Datum base)
 Ensure the validity of a spatiotemporal value and a geometry/geography. More...
 
bool ensure_valid_tspatial_geo (const Temporal *temp, const GSERIALIZED *gs)
 Ensure the validity of a spatiotemporal value and a geometry/geography. More...
 
bool ensure_valid_tspatial_tspatial (const Temporal *temp1, const Temporal *temp2)
 Ensure that two temporal numbers have the same span type. More...
 
uint32_t * geo_cluster_dbscan (const GSERIALIZED **geoms, uint32_t ngeoms, double tolerance, int minpoints)
 Return an array of integers specifying the cluster number assigned to the input geometries using the DBSCAN algorithm contains a geometry. More...
 
GSERIALIZED ** geo_cluster_intersecting (const GSERIALIZED **geoms, uint32_t ngeoms, int *count)
 Return an array of GeometryCollections partitioning the input geometries into connected clusters that are disjoint. More...
 
int * geo_cluster_kmeans (const GSERIALIZED **geoms, uint32_t n, uint32_t k)
 Return an array of integers specifying the cluster number assigned to the input geometries using the k-means algorithm contains a geometry. More...
 
GSERIALIZED ** geo_cluster_within (const GSERIALIZED **geoms, uint32_t ngeoms, double tolerance, int *count)
 Return an array of GeometryCollections partitioning the input geometries into clusters in which each geometry is within the specified distance of at least one other geometry in the same cluster. More...
 
datum_func2 geo_distance_fn (int16 flags)
 Select the appropriate distance function. More...
 
int geopoint_cmp (const GSERIALIZED *gs1, const GSERIALIZED *gs2)
 Return -1, 0, or 1 depending on whether the first point is less than, equal to, or greater than the second one. More...
 
bool geopoint_eq (const GSERIALIZED *gs1, const GSERIALIZED *gs2)
 Return true if the points are equal. More...
 
GSERIALIZEDgeopoint_make (double x, double y, double z, bool hasz, bool geodetic, int32_t srid)
 Return a point created from the arguments. More...
 
bool geopoint_same (const GSERIALIZED *gs1, const GSERIALIZED *gs2)
 Return true if the points are equal taking into account floating point imprecision. More...
 
static int16 gserialized_flags (const GSERIALIZED *gs)
 Get the MEOS flags from a geo value. More...
 
bool mline_type (const GSERIALIZED *gs)
 Ensure that the geometry/geography is a (multi)line. More...
 
datum_func2 pt_distance_fn (int16 flags)
 Select the appropriate distance function. More...
 
bool same_dimensionality_tspatial_geo (const Temporal *temp, const GSERIALIZED *gs)
 Return true if a spatiotemporal value and a geometry/geography have thesame dimensionality. More...
 
bool same_spatial_dimensionality (int16 flags1, int16 flags2)
 Return true if the two temporal points have the same spatial dimensionality as given by their flags. More...
 
int16 spatial_flags (Datum d, meosType basetype)
 Get the MEOS flags from a spatial value. More...
 
Temporaltgeo_affine (const Temporal *temp, const AFFINE *a)
 Return the 3D affine transform of a temporal geo to do things like translate, rotate, scale in one step. More...
 
Temporaltgeo_centroid (const Temporal *temp)
 Return the centroid of a temporal geo as a temporal point. More...
 
GSERIALIZEDtgeo_convex_hull (const Temporal *temp)
 Return the convex hull of a temporal geo. More...
 
Temporaltgeo_scale (const Temporal *temp, const GSERIALIZED *scale, const GSERIALIZED *sorigin)
 Scale a temporal geo by given factors. More...
 
Temporaltgeo_tpoint (const Temporal *temp, bool oper)
 Return a temporal geo transformed from/to a temporal point. More...
 
GSERIALIZEDtgeo_traversed_area (const Temporal *temp)
 Return the traversed area of a temporal geo or the trajectory for a temporal point with discrete or step interpolation. More...
 
Temporaltgeogpoint_to_tgeography (const Temporal *temp)
 Return a temporal geography from a temporal geography point. More...
 
Temporaltgeography_to_tgeogpoint (const Temporal *temp)
 Return a temporal geography point from a temporal geography. More...
 
Temporaltgeography_to_tgeometry (const Temporal *temp)
 Return a temporal geometry from to a temporal geography. More...
 
static TInstanttgeoinst_affine (TInstant *inst, const AFFINE *a)
 Return the affine transformation of a temporal geo instant. More...
 
static void tgeoinst_affine_iter (const TInstant *inst, const AFFINE *a, TInstant **result)
 Return the affine transformation of a temporal geo instant (iterator function) More...
 
static TInstanttgeoinst_scale (const TInstant *inst, const POINT4D *factors)
 Return a temporal geo instant scaled by given factors. More...
 
static void tgeoinst_scale_iter (const TInstant *inst, const POINT4D *factors, TInstant **result)
 Return the scale transformation of a temporal geo instant (iterator function) More...
 
TInstanttgeoinst_tpointinst (const TInstant *inst, bool oper)
 Return a temporal geo transformed from/to a temporal point. More...
 
Temporaltgeom_tgeog (const Temporal *temp, bool oper)
 Return a temporal geometry/geography transformed from/to a temporal geometry/geography. More...
 
Temporaltgeometry_to_tgeography (const Temporal *temp)
 Return a temporal geography from a temporal geometry. More...
 
Temporaltgeometry_to_tgeompoint (const Temporal *temp)
 Return a temporal geometry point from a temporal geometry. More...
 
TInstanttgeominst_tgeoginst (const TInstant *inst, bool oper)
 Return a temporal geometry/geography transformed from/to a temporal geometry/geography. More...
 
Temporaltgeompoint_to_tgeometry (const Temporal *temp)
 Return a temporal geometry from a temporal geometry point. More...
 
TSequencetgeomseq_tgeogseq (const TSequence *seq, bool oper)
 Return a temporal geometry/geography transformed from/to a temporal geometry/geography. More...
 
TSequenceSettgeomseqset_tgeogseqset (const TSequenceSet *ss, bool oper)
 Return a temporal geometry/geography transformed from/to a temporal geometry/geography. More...
 
static TSequencetgeoseq_affine (const TSequence *seq, const AFFINE *a)
 Return the affine transform a temporal geo sequence. More...
 
static TSequencetgeoseq_scale (const TSequence *seq, const POINT4D *factors)
 Return a temporal geo sequence scaled by given factors. More...
 
TSequencetgeoseq_tpointseq (const TSequence *seq, bool oper)
 Return a temporal geo transformed from/to a temporal point. More...
 
static TSequenceSettgeoseqset_affine (const TSequenceSet *ss, const AFFINE *a)
 Return the affine transformation of a temporal geo sequence set. More...
 
static TSequenceSettgeoseqset_scale (const TSequenceSet *ss, const POINT4D *factors)
 Return a temporal geo sequence scaled by given factors. More...
 
TSequenceSettgeoseqset_tpointseqset (const TSequenceSet *ss, bool oper)
 Return a temporal geo transformed from/to a temporal point. More...
 

Detailed Description

Spatial functions for temporal geos.