Skip to content

meos.js


meos.js / TText

Class: TText

Defined in: core/types/basic/ttext/TText.ts:58

Temporal text type.

Wraps a MEOS TText pointer and exposes text-specific operations on top of the generic Temporal API defined in Temporal.ts.

Supports all three subtypes (Instant, Sequence, SequenceSet) through the same class — the subtype is determined by the WKT string at parse time.

Note: TText uses stepwise interpolation (text values cannot be interpolated).

Example

ts
await initMeos();
const t = TText.fromString('[hello@2001-01-01, world@2001-01-02]');
console.log(t.startValue()); // hello
console.log(t.upper().startValue()); // HELLO
t.free();

Extends

  • Temporal<string>

Extended by

Constructors

Constructor

ts
new TText(inner): TText;

Defined in: core/types/basic/ttext/TText.ts:63

Parameters

inner

number

Returns

TText

Overrides

ts
Temporal<string>.constructor

Accessors

inner

Get Signature

ts
get inner(): number;

Defined in: core/types/temporal/Temporal.ts:173

Raw WASM pointer. Use when passing this value to low-level functions.

Returns

number

Inherited from

ts
Temporal.inner

Methods

[dispose]()

ts
dispose: void;

Defined in: core/types/temporal/Temporal.ts:191

Explicit Resource Management support. Allows using t = TBool.fromString(...) to free automatically.

Returns

void

Inherited from

ts
Temporal.[dispose]

alwaysEq()

ts
alwaysEq(s): boolean;

Defined in: core/types/basic/ttext/TText.ts:228

Returns true if the value is always equal to s. MEOS: always_eq_ttext_text

Parameters

s

string

Returns

boolean


alwaysLt()

ts
alwaysLt(s): boolean;

Defined in: core/types/basic/ttext/TText.ts:237

Returns true if the value is always less than s. MEOS: always_lt_ttext_text

Parameters

s

string

Returns

boolean


appendInstant()

ts
appendInstant(
   inst, 
   maxdist?, 
   maxt?, 
   expand?): this;

Defined in: core/types/temporal/Temporal.ts:528

Appends an instant to this temporal, returning a new temporal. MEOS: temporal_append_tinstant

Parameters

inst

this

The instant to append (same subtype as this).

maxdist?

number = 0

Maximum distance gap allowed (0 = no limit).

maxt?

number = 0

Maximum time gap as interval pointer (0 = no limit).

expand?

boolean = false

Whether to expand the sequence in-place.

Returns

this

Inherited from

ts
Temporal.appendInstant

appendSequence()

ts
appendSequence(seq, expand?): this;

Defined in: core/types/temporal/Temporal.ts:538

Appends a sequence to this temporal, returning a new temporal. MEOS: temporal_append_tsequence

Parameters

seq

this

expand?

boolean = false

Returns

this

Inherited from

ts
Temporal.appendSequence

asHexWKB()

ts
asHexWKB(): string;

Defined in: core/types/temporal/Temporal.ts:213

Returns the hex-encoded WKB representation.

Uses the hand-written temporal_as_hexwkb_w wrapper which internally passes variant=4 (extended WKB) and discards size_out.

MEOS: temporal_as_hexwkb

Returns

string

Inherited from

ts
Temporal.asHexWKB

asMFJSON()

ts
asMFJSON(
   withBbox?, 
   flags?, 
   precision?, 
   srs?): string;

Defined in: core/types/temporal/Temporal.ts:235

Returns the MF-JSON representation.

The hand-written wrapper converts an empty srs string to C NULL so that callers can omit the SRS without passing a null pointer directly.

MEOS: temporal_as_mfjson

Parameters

withBbox?

boolean = true

Include bounding box in the output (default true)

flags?

number = 3

Output flags (default 3)

precision?

number = 6

Coordinate decimal precision (default 6)

srs?

string | null

Spatial Reference System string, or null to omit

Returns

string

Inherited from

ts
Temporal.asMFJSON

at()

ts
at(s): TText | null;

Defined in: core/types/basic/ttext/TText.ts:206

Restrict to instants where the value equals s. MEOS: ttext_at_value

Parameters

s

string

Returns

TText | null


atMax()

ts
atMax(): this;

Defined in: core/types/temporal/Temporal.ts:406

Restricts to instants where the value is the maximum. MEOS: temporal_at_max

Returns

this

Inherited from

ts
Temporal.atMax

atMin()

ts
atMin(): this;

Defined in: core/types/temporal/Temporal.ts:401

Restricts to instants where the value is the minimum. MEOS: temporal_at_min

Returns

this

Inherited from

ts
Temporal.atMin

atTsTzSet()

ts
atTsTzSet(s): this;

Defined in: core/types/temporal/Temporal.ts:425

Restricts to the given timestamp set. MEOS: temporal_at_tstzset

Parameters

s

number

Returns

this

Inherited from

ts
Temporal.atTsTzSet

atTsTzSpan()

ts
atTsTzSpan(s): this;

Defined in: core/types/temporal/Temporal.ts:430

Restricts to the given timestamp span. MEOS: temporal_at_tstzspan

Parameters

s

number

Returns

this

Inherited from

ts
Temporal.atTsTzSpan

atTsTzSpanSet()

ts
atTsTzSpanSet(ss): this;

Defined in: core/types/temporal/Temporal.ts:435

Restricts to the given timestamp span set. MEOS: temporal_at_tstzspanset

Parameters

ss

number

Returns

this

Inherited from

ts
Temporal.atTsTzSpanSet

concat()

ts
concat(other): TText;

Defined in: core/types/basic/ttext/TText.ts:184

Concatenates other to this TText. MEOS: textcat_ttext_text / textcat_ttext_ttext

Parameters

other

string | TText

Returns

TText


copy()

ts
copy(): this;

Defined in: core/types/temporal/Temporal.ts:199

Returns a deep copy of this temporal value. MEOS: temporal_copy

Returns

this

Inherited from

ts
Temporal.copy

durationMs()

ts
durationMs(ignoreGaps?): number;

Defined in: core/types/temporal/Temporal.ts:385

Returns the total duration as a number of milliseconds.

Uses the hand-written temporal_duration_us_w wrapper which converts the MEOS Interval* return value to a plain int64 (total microseconds). The result is divided by 1000 to return milliseconds.

Pass ignoreGaps=true to sum only sequence durations, ignoring the time gaps between sequences in a SequenceSet.

MEOS: temporal_duration

Parameters

ignoreGaps?

boolean = false

Returns

number

Inherited from

ts
Temporal.durationMs

endInstant()

ts
endInstant(): this;

Defined in: core/types/temporal/Temporal.ts:286

Returns the last instant as a new instance of the same subtype. MEOS: temporal_end_instant

Returns

this

Inherited from

ts
Temporal.endInstant

endTimestamp()

ts
endTimestamp(): number;

Defined in: core/types/temporal/Temporal.ts:362

Returns the last timestamp as microseconds since 2000-01-01 UTC. MEOS: temporal_end_timestamptz

Returns

number

Inherited from

ts
Temporal.endTimestamp

endValue()

ts
endValue(): string;

Defined in: core/types/basic/ttext/TText.ts:122

Ending value. MEOS: ttext_end_value

Returns

string

Overrides

ts
Temporal.endValue

equals()

ts
equals(other): boolean;

Defined in: core/types/temporal/Temporal.ts:558

Pointer-based identity check. For value equality, use the generated teq_* / temporal_eq functions.

Parameters

other

Temporal<string>

Returns

boolean

Inherited from

ts
Temporal.equals

everEq()

ts
everEq(s): boolean;

Defined in: core/types/basic/ttext/TText.ts:225

Returns true if the value is ever equal to s. MEOS: ever_eq_ttext_text

Parameters

s

string

Returns

boolean


everLt()

ts
everLt(s): boolean;

Defined in: core/types/basic/ttext/TText.ts:234

Returns true if the value is ever less than s. MEOS: ever_lt_ttext_text

Parameters

s

string

Returns

boolean


free()

ts
free(): void;

Defined in: core/types/temporal/Temporal.ts:183

Frees the underlying MEOS allocation.

After calling free(), the instance must not be used. Calls the hand-written meos_free wrapper from res/bindings_c_header.txt.

Returns

void

Inherited from

ts
Temporal.free

initcap()

ts
initcap(): TText;

Defined in: core/types/basic/ttext/TText.ts:176

Returns a new TText with initcap applied (first letter of each word uppercased). MEOS: ttext_initcap

Returns

TText


instantN()

ts
instantN(n): this;

Defined in: core/types/temporal/Temporal.ts:320

Returns the n-th instant (0-based index).

Uses the hand-written temporal_instant_n_w wrapper which converts the 0-based JS index to the 1-based index expected by MEOS internally.

MEOS: temporal_instant_n

Parameters

n

number

Returns

this

Inherited from

ts
Temporal.instantN

interpolation()

ts
interpolation(): TInterpolation;

Defined in: core/types/temporal/Temporal.ts:248

Returns the interpolation mode of this temporal value. MEOS: temporal_interp

Returns

TInterpolation

Inherited from

ts
Temporal.interpolation

lower()

ts
lower(): TText;

Defined in: core/types/basic/ttext/TText.ts:171

Returns a new TText with all characters lowercased. MEOS: ttext_lower

Returns

TText


maxInstant()

ts
maxInstant(): this;

Defined in: core/types/temporal/Temporal.ts:306

Returns the instant with the maximum value. MEOS: temporal_max_instant

Returns

this

Inherited from

ts
Temporal.maxInstant

maxValue()

ts
maxValue(): string;

Defined in: core/types/basic/ttext/TText.ts:136

Maximum value (lexicographic). MEOS: ttext_max_value

Returns

string


merge()

ts
merge(other): this;

Defined in: core/types/temporal/Temporal.ts:546

Merges this temporal with another, returning a new temporal. MEOS: temporal_merge

Parameters

other

this

Returns

this

Inherited from

ts
Temporal.merge

minInstant()

ts
minInstant(): this;

Defined in: core/types/temporal/Temporal.ts:296

Returns the instant with the minimum value. MEOS: temporal_min_instant

Returns

this

Inherited from

ts
Temporal.minInstant

minus()

ts
minus(s): TText | null;

Defined in: core/types/basic/ttext/TText.ts:215

Restrict to instants where the value differs from s. MEOS: ttext_minus_value

Parameters

s

string

Returns

TText | null


minusMax()

ts
minusMax(): this;

Defined in: core/types/temporal/Temporal.ts:416

Excludes instants where the value is the maximum. MEOS: temporal_minus_max

Returns

this

Inherited from

ts
Temporal.minusMax

minusMin()

ts
minusMin(): this;

Defined in: core/types/temporal/Temporal.ts:411

Excludes instants where the value is the minimum. MEOS: temporal_minus_min

Returns

this

Inherited from

ts
Temporal.minusMin

minusTsTzSet()

ts
minusTsTzSet(s): this;

Defined in: core/types/temporal/Temporal.ts:440

Excludes the given timestamp set. MEOS: temporal_minus_tstzset

Parameters

s

number

Returns

this

Inherited from

ts
Temporal.minusTsTzSet

minusTsTzSpan()

ts
minusTsTzSpan(s): this;

Defined in: core/types/temporal/Temporal.ts:445

Excludes the given timestamp span. MEOS: temporal_minus_tstzspan

Parameters

s

number

Returns

this

Inherited from

ts
Temporal.minusTsTzSpan

minusTsTzSpanSet()

ts
minusTsTzSpanSet(ss): this;

Defined in: core/types/temporal/Temporal.ts:450

Excludes the given timestamp span set. MEOS: temporal_minus_tstzspanset

Parameters

ss

number

Returns

this

Inherited from

ts
Temporal.minusTsTzSpanSet

minValue()

ts
minValue(): string;

Defined in: core/types/basic/ttext/TText.ts:131

Minimum value (lexicographic). MEOS: ttext_min_value

Returns

string


neverEq()

ts
neverEq(s): boolean;

Defined in: core/types/basic/ttext/TText.ts:231

Returns true if the value is never equal to s.

Parameters

s

string

Returns

boolean


numInstants()

ts
numInstants(): number;

Defined in: core/types/temporal/Temporal.ts:263

Returns the number of distinct instants in this temporal value. MEOS: temporal_num_instants

Returns

number

Inherited from

ts
Temporal.numInstants

numTimestamps()

ts
numTimestamps(): number;

Defined in: core/types/temporal/Temporal.ts:334

Returns the number of distinct timestamps. MEOS: temporal_num_timestamps

Returns

number

Inherited from

ts
Temporal.numTimestamps

prepend()

ts
prepend(prefix): TText;

Defined in: core/types/basic/ttext/TText.ts:194

Prepends prefix before this TText. MEOS: textcat_text_ttext

Parameters

prefix

string

Returns

TText


scaleTime()

ts
scaleTime(duration): this;

Defined in: core/types/temporal/Temporal.ts:464

Scales the temporal domain to the given duration interval pointer. MEOS: temporal_scale_time

Parameters

duration

number

Returns

this

Inherited from

ts
Temporal.scaleTime

setInterp()

ts
setInterp(interp): this;

Defined in: core/types/temporal/Temporal.ts:478

Returns a new temporal with the interpolation changed to interp. Pass TInterpolation values as numbers: Discrete=0, Stepwise=1, Linear=2. MEOS: temporal_set_interp

Parameters

interp

TInterpolation

Returns

this

Inherited from

ts
Temporal.setInterp

shiftScaleTime()

ts
shiftScaleTime(shift, duration): this;

Defined in: core/types/temporal/Temporal.ts:469

Shifts and scales the temporal domain. MEOS: temporal_shift_scale_time

Parameters

shift

number

duration

number

Returns

this

Inherited from

ts
Temporal.shiftScaleTime

shiftTime()

ts
shiftTime(shift): this;

Defined in: core/types/temporal/Temporal.ts:459

Shifts the temporal domain by the given interval pointer. MEOS: temporal_shift_time

Parameters

shift

number

Returns

this

Inherited from

ts
Temporal.shiftTime

startInstant()

ts
startInstant(): this;

Defined in: core/types/temporal/Temporal.ts:276

Returns the first instant as a new instance of the same subtype. MEOS: temporal_start_instant

Returns

this

Inherited from

ts
Temporal.startInstant

startTimestamp()

ts
startTimestamp(): number;

Defined in: core/types/temporal/Temporal.ts:347

Returns the first timestamp as microseconds since 2000-01-01 UTC. MEOS: temporal_start_timestamptz

Returns

number

Inherited from

ts
Temporal.startTimestamp

startValue()

ts
startValue(): string;

Defined in: core/types/basic/ttext/TText.ts:117

Starting value. MEOS: ttext_start_value

Returns

string

Overrides

ts
Temporal.startValue

temporalEq()

ts
temporalEq(s): number;

Defined in: core/types/basic/ttext/TText.ts:244

Temporal equality: returns a TBool ptr that is true where this == s. MEOS: teq_ttext_text

Parameters

s

string

Returns

number


temporalGe()

ts
temporalGe(s): number;

Defined in: core/types/basic/ttext/TText.ts:259

Temporal greater-than-or-equal. MEOS: tge_ttext_text

Parameters

s

string

Returns

number


temporalGt()

ts
temporalGt(s): number;

Defined in: core/types/basic/ttext/TText.ts:256

Temporal greater-than. MEOS: tgt_ttext_text

Parameters

s

string

Returns

number


temporalLe()

ts
temporalLe(s): number;

Defined in: core/types/basic/ttext/TText.ts:253

Temporal less-than-or-equal. MEOS: tle_ttext_text

Parameters

s

string

Returns

number


temporalLt()

ts
temporalLt(s): number;

Defined in: core/types/basic/ttext/TText.ts:250

Temporal less-than. MEOS: tlt_ttext_text

Parameters

s

string

Returns

number


temporalNe()

ts
temporalNe(s): number;

Defined in: core/types/basic/ttext/TText.ts:247

Temporal inequality. MEOS: tne_ttext_text

Parameters

s

string

Returns

number


toInstant()

ts
toInstant(): this;

Defined in: core/types/temporal/Temporal.ts:489

Converts to TInstant (must already be an instant). MEOS: temporal_to_tinstant

Returns

this

Inherited from

ts
Temporal.toInstant

toSequence()

ts
toSequence(interp): this;

Defined in: core/types/temporal/Temporal.ts:494

Converts to TSequence with the given interpolation. MEOS: temporal_to_tsequence

Parameters

interp

TInterpolation

Returns

this

Inherited from

ts
Temporal.toSequence

toSequenceSet()

ts
toSequenceSet(interp): this;

Defined in: core/types/temporal/Temporal.ts:505

Converts to TSequenceSet with the given interpolation. MEOS: temporal_to_tsequenceset

Parameters

interp

TInterpolation

Returns

this

Inherited from

ts
Temporal.toSequenceSet

toString()

ts
toString(): string;

Defined in: core/types/basic/ttext/TText.ts:112

WKT string representation. MEOS: ttext_out

Returns

string

Overrides

ts
Temporal.toString

upper()

ts
upper(): TText;

Defined in: core/types/basic/ttext/TText.ts:166

Returns a new TText with all characters uppercased. MEOS: ttext_upper

Returns

TText


valueAtTimestamp()

ts
valueAtTimestamp(t): string | null;

Defined in: core/types/basic/ttext/TText.ts:153

Evaluates the temporal at a specific timestamp. Returns null when the timestamp is outside the temporal's domain. MEOS: temporal_at_timestamptz + ttext_start_value

Parameters

t

number

Returns

string | null


valueN()

ts
valueN(n): string | null;

Defined in: core/types/basic/ttext/TText.ts:144

Returns the n-th distinct value (0-based index), or null if out of range. MEOS: ttext_value_n

Parameters

n

number

Returns

string | null


fromBaseTemporal()

ts
static fromBaseTemporal(s, domain): TText;

Defined in: core/types/basic/ttext/TText.ts:87

Create a TText with constant value s spanning the same domain as domain. MEOS: ttext_from_base_temp

Parameters

s

string

domain

TText

Returns

TText


fromBaseTime()

ts
static fromBaseTime(
   s, 
   time, 
   type): TText;

Defined in: core/types/basic/ttext/TText.ts:95

Create a TText with constant value s over a time object. MEOS: ttextseq_from_base_tstzset / tstzspan / ttextseqset_from_base_tstzspanset

Parameters

s

string

time

number

type

"tstzset" | "tstzspan" | "tstzspanset"

Returns

TText


fromMFJSON()

ts
static fromMFJSON(mfjson): TText;

Defined in: core/types/basic/ttext/TText.ts:79

Parse a TText from a MF-JSON string. MEOS: ttext_from_mfjson

Parameters

mfjson

string

Returns

TText


fromString()

ts
static fromString(wkt): TText;

Defined in: core/types/basic/ttext/TText.ts:71

Parse a TText from a WKT string. MEOS: ttext_in

Parameters

wkt

string

Returns

TText