MobilityDB  1.0
Macros | Functions | Variables
tpoint_out.c File Reference

Output of temporal points in WKT, EWKT, WKB, EWKB, and MF-JSON format. More...

#include "point/tpoint_out.h"
#include <assert.h>
#include <float.h>
#include <utils/builtins.h>
#include "general/temporaltypes.h"
#include "general/tempcache.h"
#include "general/temporal_util.h"
#include "point/tpoint.h"
#include "point/tpoint_spatialfuncs.h"
Include dependency graph for tpoint_out.c:

Macros

#define OUT_SHOW_DIGS_DOUBLE   20
 
#define OUT_MAX_DOUBLE_PRECISION   15
 
#define OUT_MAX_DIGS_DOUBLE   (OUT_SHOW_DIGS_DOUBLE + 2) /* +2 mean add dot and sign */
 
#define OUT_DOUBLE_BUFFER_SIZE   OUT_MAX_DIGS_DOUBLE + OUT_MAX_DOUBLE_PRECISION + 1
 
#define WKT_ISO   0x01
 Variants available for WKB and WKT output types. More...
 
#define WKT_EXTENDED   0x04
 

Functions

static char * wkt_out (Oid type, Datum value)
 Output a geometry in Well-Known Text (WKT) format. More...
 
char * ewkt_out (Oid type, Datum value)
 Output a geometry in Extended Well-Known Text (EWKT) format, that is, in WKT format prefixed with the SRID. More...
 
static char * tpoint_as_text_internal1 (const Temporal *temp)
 Output a temporal point in Well-Known Text (WKT) format (dispatch function) More...
 
static text * tpoint_as_text_internal (const Temporal *temp)
 Output a temporal point in Well-Known Text (WKT) format. More...
 
PGDLLEXPORT Datum tpoint_as_text (PG_FUNCTION_ARGS)
 Output a temporal point in Well-Known Text (WKT) format. More...
 
static text * tpoint_as_ewkt_internal (const Temporal *temp)
 Output a temporal point in Extended Well-Known Text (EWKT) format, that is, in WKT format prefixed with the SRID (dispatch function) More...
 
PGDLLEXPORT Datum tpoint_as_ewkt (PG_FUNCTION_ARGS)
 Output a temporal point in Extended Well-Known Text (EWKT) format, that is, in WKT format prefixed with the SRID. More...
 
Datum geoarr_as_text1 (FunctionCallInfo fcinfo, bool extended)
 Output a geometry/geography array in Well-Known Text (WKT) format. More...
 
PGDLLEXPORT Datum geoarr_as_text (PG_FUNCTION_ARGS)
 Output a geometry/geography array in Well-Known Text (WKT) format. More...
 
PGDLLEXPORT Datum geoarr_as_ewkt (PG_FUNCTION_ARGS)
 Output a geometry/geography array in Extended Well-Known Text (EWKT) format, that is, in WKT format prefixed with the SRID. More...
 
Datum tpointarr_as_text1 (FunctionCallInfo fcinfo, bool extended)
 Output a temporal point array in Well-Known Text (WKT) or Extended Well-Known Text (EWKT) format. More...
 
PGDLLEXPORT Datum tpointarr_as_text (PG_FUNCTION_ARGS)
 Output a temporal point array in Well-Known Text (WKT) format. More...
 
PGDLLEXPORT Datum tpointarr_as_ewkt (PG_FUNCTION_ARGS)
 Output a temporal point array in Extended Well-Known Text (EWKT) format, that is, in WKT format prefixed with the SRID. More...
 
static size_t coordinates_mfjson_size (int npoints, bool hasz, int precision)
 Returns the maximum size in bytes of the coordinate array represented in MF-JSON format. More...
 
static size_t coordinates_mfjson_buf (char *output, const TInstant *inst, int precision)
 Writes into the buffer the coordinate array represented in MF-JSON format. More...
 
static size_t datetimes_mfjson_size (int npoints)
 Returns the maximum size in bytes of the datetimes array represented in MF-JSON format. More...
 
static size_t datetimes_mfjson_buf (char *output, const TInstant *inst)
 Writes into the buffer the datetimes array represented in MF-JSON format. More...
 
static size_t srs_mfjson_size (char *srs)
 Returns the maximum size in bytes of the SRS represented in MF-JSON format. More...
 
static size_t srs_mfjson_buf (char *output, char *srs)
 Writes into the buffer the SRS represented in MF-JSON format. More...
 
static size_t bbox_mfjson_size (int hasz, int precision)
 Returns the maximum size in bytes of the bouding box represented in MF-JSON format. More...
 
static size_t bbox_mfjson_buf (char *output, const STBOX *bbox, int hasz, int precision)
 Writes into the buffer the bouding box represented in MF-JSON format. More...
 
static size_t tpointinst_as_mfjson_size (const TInstant *inst, int precision, const STBOX *bbox, char *srs)
 Returns the maximum size in bytes of a temporal instant point represented in MF-JSON format. More...
 
static size_t tpointinst_as_mfjson_buf (const TInstant *inst, int precision, const STBOX *bbox, char *srs, char *output)
 Writes into the buffer the temporal instant point represented in MF-JSON format. More...
 
static char * tpointinst_as_mfjson (const TInstant *inst, int precision, const STBOX *bbox, char *srs)
 Returns the temporal instant point represented in MF-JSON format. More...
 
static size_t tpointinstset_as_mfjson_size (const TInstantSet *ti, int precision, const STBOX *bbox, char *srs)
 Returns the maximum size in bytes of a temporal instant set point represented in MF-JSON format. More...
 
static size_t tpointinstset_as_mfjson_buf (const TInstantSet *ti, int precision, const STBOX *bbox, char *srs, char *output)
 Writes into the buffer the temporal instant set point represented in MF-JSON format. More...
 
static char * tpointinstset_as_mfjson (const TInstantSet *ti, int precision, const STBOX *bbox, char *srs)
 Returns the temporal instant set point represented in MF-JSON format. More...
 
static size_t tpointseq_as_mfjson_size (const TSequence *seq, int precision, const STBOX *bbox, char *srs)
 Returns the maximum size in bytes of a temporal sequence point represented in MF-JSON format. More...
 
static size_t tpointseq_as_mfjson_buf (const TSequence *seq, int precision, const STBOX *bbox, char *srs, char *output)
 Writes into the buffer the temporal sequence point represented in MF-JSON format. More...
 
static char * tpointseq_as_mfjson (const TSequence *seq, int precision, const STBOX *bbox, char *srs)
 Returns the temporal sequence point represented in MF-JSON format. More...
 
static size_t tpointseqset_as_mfjson_size (const TSequenceSet *ts, int precision, const STBOX *bbox, char *srs)
 Returns the maximum size in bytes of a temporal sequence set point represented in MF-JSON format. More...
 
static size_t tpointseqset_as_mfjson_buf (const TSequenceSet *ts, int precision, const STBOX *bbox, char *srs, char *output)
 Writes into the buffer the temporal sequence set point represented in MF-JSON format. More...
 
static char * tpointseqset_as_mfjson (const TSequenceSet *ts, int precision, const STBOX *bbox, char *srs)
 Returns the temporal sequence set point represented in MF-JSON format. More...
 
PGDLLEXPORT Datum tpoint_as_mfjson (PG_FUNCTION_ARGS)
 Returns the temporal point represented in MF-JSON format. More...
 
static uint8_t * endian_to_wkb_buf (uint8_t *buf, uint8_t variant)
 Writes into the buffer the Endian represented in Well-Known Binary (WKB) format. More...
 
static bool wkb_swap_bytes (uint8_t variant)
 Returns true if the bytes must be swaped dependng of the variant. More...
 
static uint8_t * integer_to_wkb_buf (const int ival, uint8_t *buf, uint8_t variant)
 Writes into the buffer the Integer32 represented in Well-Known Binary (WKB) format. More...
 
static uint8_t * double_to_wkb_buf (double d, uint8_t *buf, uint8_t variant)
 Writes into the buffer the float64 represented in Well-Known Binary (WKB) format. More...
 
static uint8_t * timestamp_to_wkb_buf (TimestampTz t, uint8_t *buf, uint8_t variant)
 Writes into the buffer the TimestampTz (aka int64) represented in Well-Known Binary (WKB) format. More...
 
static bool tpoint_wkb_needs_srid (const Temporal *temp, uint8_t variant)
 Returns true if the temporal point needs to output the SRID. More...
 
static size_t tpointinstarr_to_wkb_size (int npoints, bool hasz, uint8_t variant)
 Returns the maximum size in bytes of an array of temporal instant points represented in Well-Known Binary (WKB) format. More...
 
static size_t tpointinst_to_wkb_size (const TInstant *inst, uint8_t variant)
 Returns the maximum size in bytes of the temporal instant point represented in Well-Known Binary (WKB) format. More...
 
static size_t tpointinstset_to_wkb_size (const TInstantSet *ti, uint8_t variant)
 Returns the maximum size in bytes of the temporal instant set point represented in Well-Known Binary (WKB) format. More...
 
static size_t tpointseq_to_wkb_size (const TSequence *seq, uint8_t variant)
 Returns the maximum size in bytes of the temporal sequence point represented in Well-Known Binary (WKB) format. More...
 
static size_t tpointseqset_to_wkb_size (const TSequenceSet *ts, uint8_t variant)
 Returns the maximum size in bytes of the temporal sequence set point represented in Well-Known Binary (WKB) format. More...
 
static size_t tpoint_to_wkb_size (const Temporal *temp, uint8_t variant)
 Returns the maximum size in bytes of the temporal point represented in Well-Known Binary (WKB) format (dispatch function) More...
 
static uint8_t * tpoint_wkb_type (const Temporal *temp, uint8_t *buf, uint8_t variant)
 Writes into the buffer the flag containing the temporal type and other characteristics represented in Well-Known Binary (WKB) format. More...
 
static uint8_t * coords_ts_to_wkb_buf (const TInstant *inst, uint8_t *buf, uint8_t variant)
 Writes into the buffer the coordinates of the temporal instant point represented in Well-Known Binary (WKB) format as follows. More...
 
static uint8_t * tpointinst_to_wkb_buf (const TInstant *inst, uint8_t *buf, uint8_t variant)
 Writes into the buffer the temporal instant point represented in Well-Known Binary (WKB) format as follows. More...
 
static uint8_t * tpointinstset_to_wkb_buf (const TInstantSet *ti, uint8_t *buf, uint8_t variant)
 Writes into the buffer the temporal instant set point represented in Well-Known Binary (WKB) format as follows. More...
 
static uint8_t * tpointseq_wkb_bounds (const TSequence *seq, uint8_t *buf, uint8_t variant)
 Writes into the buffer the flag containing the bounds represented in Well-Known Binary (WKB) format as follows xxxxxxUL x = Unused bits, U = Upper inclusive, L = Lower inclusive. More...
 
static uint8_t * tpointseq_to_wkb_buf (const TSequence *seq, uint8_t *buf, uint8_t variant)
 Writes into the buffer the temporal sequence point represented in Well-Known Binary (WKB) format as follows. More...
 
static uint8_t * tpointseqset_to_wkb_buf (const TSequenceSet *ts, uint8_t *buf, uint8_t variant)
 Writes into the buffer the temporal sequence set point represented in Well-Known Binary (WKB) format as follows. More...
 
static uint8_t * tpoint_to_wkb_buf (const Temporal *temp, uint8_t *buf, uint8_t variant)
 Writes into the buffer the temporal point represented in Well-Known Binary (WKB) format. More...
 
static uint8_t * tpoint_to_wkb (const Temporal *temp, uint8_t variant, size_t *size_out)
 Convert the temporal value to a char * in WKB format. More...
 
static void ensure_valid_endian_flag (const char *endian)
 Ensures that the spatiotemporal boxes have the same type of coordinates, either planar or geodetic. More...
 
Datum tpoint_as_binary1 (FunctionCallInfo fcinfo, bool extended)
 Output the temporal point in WKB or EWKB format. More...
 
PGDLLEXPORT Datum tpoint_as_binary (PG_FUNCTION_ARGS)
 Output a temporal point in WKB format. More...
 
PGDLLEXPORT Datum tpoint_as_ewkb (PG_FUNCTION_ARGS)
 Output the temporal point in EWKB format. More...
 
PGDLLEXPORT Datum tpoint_as_hexewkb (PG_FUNCTION_ARGS)
 Output the temporal point in HexEWKB format. More...
 

Variables

static char * hexchr = "0123456789ABCDEF"
 Look-up table for hex writer. More...
 

Detailed Description

Output of temporal points in WKT, EWKT, WKB, EWKB, and MF-JSON format.