Skip to Content
teigeodata
Reference

Reference

Every function, method, record and error of the API, with its documentation and its declaration in each language.

The API is defined once, in Rust (teigeodata-api), and every binding is generated from that definition, so this reference is generated from it too: each entry gives the documentation written in the API and the declaration each language's binding is written with. It holds 33 engine methods, 22 store and job methods and 8 functions.

Names follow each language's style; the entries use the Rust ones:

Rust, Python, C++JavaScript, Swift, Java, Kotlin, DartGo, .NETC
search_withsearchWithSearchWithtg_engine_search_with
admin_atadminAtAdminAttg_engine_admin_at
tz_offset_attzOffsetAtTzOffsetAttg_engine_tz_offset_at

Queries return a result blob read with each language's Reader. The servers have their own reference: every route of the HTTP API and every tool of the MCP server, generated from the servers' own definitions.

Engine

The Engine page has each method's declaration in every language.

NameWhat
newAn engine with no packs.
open_fileOpens the pack at path (memory-mapped) and adds it.
open_file_withOpens the pack at path with these options and adds it.
open_file_rangeOpens the pack stored whole in length bytes at offset of the file at path (memory-mapped) and adds it: a pack bundled as an uncompressed asset of an Android app (noCompress; the path is the APK, the offset and length its AssetFileDescriptor's), or one inside any container that stores it uncompressed.
open_file_range_withAs open_file_range, with these options.
open_bytesAdds a pack from its bytes (copied).
open_bytes_withAdds a pack from its bytes (copied) with these options.
removeRemoves the pack with this layer ID; false if no pack has it.
layersThe number of packs.
getThe place with this ID (tgd:np/1), or no row; a retired ID gives its survivor.
parentThe place's parent as the packs answer for it (one row), or no row for a root or an unknown ID.
ancestorsThe place's ancestors, parent first up to the country; no rows for a root or an unknown ID.
childrenThe place's children, by ID; no rows for a leaf or an unknown ID.
nearbyThe places nearest the place with this ID, not counting it, nearest first, at most limit, with meters and bearing (from each place to it); no rows for an unknown ID.
searchPlaces matching query, best first, at most limit; "Name, Parent" ranks a named parent first.
search_withsearch ranked by options: near a focus point, or in strict match order.
reverseThe places nearest the point, nearest first, at most limit, with meters and bearing (degrees clockwise from north, from each place to the point).
within_radiusThe places within radius_m metres of the point (great-circle), nearest first, at most limit, with meters and bearing (from each place to the point).
admin_atThe admin units holding the point, country first.
elevation_atThe terrain height at the point, as one row: meters above the datum (bilinear between the DEM samples around it), source (the DEM product's key, null where the pack does not state it), resolution_m (the sample spacing north to south) and datum (EGM2008).
postal_lookupThe places postal code code names, one row per code and place, with the code's postal, scheme, code_kind, valid_from and valid_to columns.
postal_prefixUp to limit postal codes starting with prefix, with their places (autocomplete), in code order per scheme; scheme as in postal_lookup.
postal_codes_ofThe postal codes of the place with this ID; no rows for an unknown ID.
postal_atThe postal codes of the point: those of the deepest admin unit holding it that an admin-aligned scheme gives codes to, with its parts (a ward's code; the point is in one of them).
tz_atThe time-zone area holding the point (one row; its tz column is the IANA zone), or no row where no pack answers.
tz_offset_atThe UTC offset in force in zone (a tzdb name or link, Asia/Kathmandu) at unix_seconds, from the first layer whose zone rules hold the zone: one row with seconds east of UTC, dst (1 when tzdb counts it as daylight saving time) and abbr (+0545, EDT); no row where no layer holds the zone.
tz_localThe offsets a civil time may have in zone: one row with kind (unique, gap for a time a transition skips, overlap for one that happens twice), before and after in seconds east of UTC (the offsets before and after the transition: for an overlap the earlier and the later instant's; for a unique time both the same); no row where no layer holds the zone.
tz_zonesEvery zone name (tzdb names and links) the layers' zone rules hold, in byte order: one zone column.
tz_rules_startThe earliest instant zone's rules cover, in Unix seconds: one unix row (its first transition, before which tzdb knows only local mean time; the year −9,999 for a zone that never changed); no row where no layer holds the zone.
tz_versionThe tzdb release (2026f) of the first layer with zone rules; empty without rules.
by_isoThe place whose ISO 3166 code is code (NP, NP-P3, either case), or no row.
boundaryThe outline of the place with this ID at level of detail lod, as one row: id, lod (the level read: 0 from a pack stored at full resolution only), tolerance_m (how far it may stray from the full-resolution outline), vertices and geojson, an RFC 7946 Feature ready for a map: a Polygon or MultiPolygon (outer rings counterclockwise, holes clockwise), or the place's Point when it has no outline.
distanceThe great-circle distance between the places with these IDs, as one row: meters on the mean Earth sphere and bearing, the initial bearing from from to to in degrees clockwise from north.

Store

The Store page has each method's declaration in every language.

NameWhat
createSets up a store at root and opens it: the metadata mirrors repo and asset mirrors assets (comma-separated URLs), and trusted_root, the catalog's root metadata, which becomes its trust anchor once it verifies by itself.
openOpens the store at root, finishing or undoing an install a crash cut short.
damagedThe packs found damaged when the store was opened, comma-separated; empty when none.
catalogThe verified catalog as stored, one row per pack, with its state against the store.
statusEach installed pack and its health, from a full check of every byte when deep.
pinPins the pack (kept when room is made), or unpins it.
removeRemoves the packs and the dependencies nothing else needs; returns what was removed.
findThe places named query in engine (one over a world pack the app ships, the installed packs, or both), best first, each with the catalog's packs that cover it: what to install for "Dubai".
locateThe countries within radius_m metres of a point in engine, each with the catalog's packs that cover the point: what to install for where the user stands.
engineAn engine over the installed packs, each opened with the components and languages installed.
refreshRefreshes the catalog for the countries (comma-separated ISO codes) and every country installed.
installInstalls the packs with options, dependencies first, refreshing the catalog for their countries.
install_passOne pass of an install whose bytes a platform's own download service fetches, for downloads that must go on while the app is suspended.
updateUpdates the packs (every installed one when empty) to the catalog's releases, keeping the components and languages installed.
repairChecks the pack in full and, unless it is whole, fetches what it lacks.

Job

A job's methods are on the Store page.

NameWhat
wait_progressWaits until the progress moves past seq (from seq), the job ends, or timeout_ms passes; returns the sequence then.
seqThe progress's sequence number: it moves on with every change.
done_bytesBytes received so far.
total_bytesBytes expected, from the catalog's sizes: never below the bytes received, and equal to them once the job ends.
is_endedWhether the job has ended (done, failed or cancelled); its result is then ready.
cancelAsks the job to stop at its next request or chunk; it then fails with ErrorCode::Cancelled and leaves the store as it was.
resultThe job's result, waiting for it to end.

Functions

The functions page has each declaration in every language.

NameWhat
versionThe library version, from its package metadata.
componentsThe components this build answers, in table order, comma-separated (point, elevation, admin).
noopDoes nothing.
foldThe search fold of a name: NFKD, lower case, optional accents dropped by script, spaces collapsed, recomposed to NFC.
sample_rowsBuilds rows deterministic sample places as a blob with the columns id (u32), lat and lon (f64, degrees), elevation (f32, metres) and name (UTF-8).
progressCalls on_step once per step with the step number, from 1 to steps, on the calling thread, and returns the number of steps run.
distance_mGreat-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.
bearing_degThe 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.

Types, constants and errors

Every record, enum, constant and error code is on the types page:

SearchOptions, OpenOptions, InstallOptions; Verify, Load; constants and error codes.

On this page