Skip to Content
teigeodata
Reference

Functions

The library's free functions, outside any engine.

These need no engine and no pack. noop, sample_rows and progress exist to measure and test each binding's call, result and callback paths; an application does not need them.

version

The library version, from its package metadata.

pub fn version() -> String

components

The components this build answers, in table order, comma-separated (point, elevation, admin). A build made without one answers its queries as a layer installed without it does: no rows, or ErrorCode::MissingComponent.

pub fn components() -> String

noop

Does nothing. Measures the bare cost of a call across each boundary.

pub fn noop()

fold

The search fold of a name: NFKD, lower case, optional accents dropped by script, spaces collapsed, recomposed to NFC. The same fold the forge and the search index use.

Errors. ErrorCode::MissingComponent in a build without search, whose Unicode tables it uses.

pub fn fold(text: &str) -> Result<String>

sample_rows

Builds rows deterministic sample places as a blob with the columns id (u32), lat and lon (f64, degrees), elevation (f32, metres) and name (UTF-8). Exercises the result path of every binding.

Errors. ErrorCode::InvalidArgument if rows exceeds SAMPLE_ROWS_MAX.

pub fn sample_rows(rows: u32) -> Result<Blob>

progress

Calls on_step once per step with the step number, from 1 to steps, on the calling thread, and returns the number of steps run. Exercises callbacks in every binding.

Errors. ErrorCode::Cancelled if on_step returns false.

pub fn progress(steps: u32, on_step: &mut dyn FnMut(u32) -> bool) -> Result<u32>

distance_m

Great-circle distance in metres between two points in degrees, by the haversine formula on the mean Earth sphere (error up to about 0.5% against the ellipsoid), as every query measures it, with the same digits on every platform.

Errors. ErrorCode::InvalidArgument if a latitude is outside -90..=90, a longitude outside -180..=180, or any value is not finite.

pub fn distance_m(lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> Result<f64>

bearing_deg

The initial great-circle bearing from the first point to the second, in degrees clockwise from true north in [0, 360); 0 for one point twice or from a pole. The same digits on every platform.

Errors. ErrorCode::InvalidArgument if a latitude is outside -90..=90, a longitude outside -180..=180, or any value is not finite.

pub fn bearing_deg(lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> Result<f64>

On this page