asg017/sqlite-tg

SQLite extension around tg, a geometric library for limited GIS operations

C

50

167 commits

updated Aug 8, 2026

See the code

README

sqlite-tg

Work-in-progress geospatial SQLite extension around tg. Not ready yet, but feel free to play with it!

Once stabilized, will be a part of sqlite-ecosystem.

Usage

.load ./tg0

select tg_point_wkt(1, 2);
-- 'POINT(1 2)'

tg and therefore sqlite-tg support WKT, WKB, and GeoJSON. Most functions will accept any of these formats, and you can convert between them with tg_to_geojson(), tg_to_wkb(), and tg_to_wkt().

select tg_to_geojson('POINT(1 2)');
-- '{"type":"Point","coordinates":[1,2]}'

select tg_to_wkb('POINT(1 2)');
-- X'0101000000000000000000f03f0000000000000040'

select tg_to_wkt('{"type":"Point","coordinates":[1,2]}');
-- 'POINT(1 2)'

Documentation

See docs.md for a full API reference.

Installing

LanguageInstall
Pythonpip install sqlite-tgPyPI
Datasettedatasette install datasette-sqlite-tgDatasette
sqlite-utilssqlite-utils install sqlite-utils-sqlite-tgsqlite-utils
Node.jsnpm install sqlite-tgnpm
Denodeno.land/x/sqlite_tgdeno.land/x release
Rubygem install sqlite-tgGem
Github ReleaseGitHub tag (latest SemVer pre-release)
sqlite
sqlite-extension

Contributors

asg017

165 commits

simonw

2 commits

asg017/sqlite-tg

SQLite extension around tg, a geometric library for limited GIS operations

C

50

167 commits

updated Aug 8, 2026

See the code

README

sqlite-tg

Work-in-progress geospatial SQLite extension around tg. Not ready yet, but feel free to play with it!

Once stabilized, will be a part of sqlite-ecosystem.

Usage

.load ./tg0

select tg_point_wkt(1, 2);
-- 'POINT(1 2)'

tg and therefore sqlite-tg support WKT, WKB, and GeoJSON. Most functions will accept any of these formats, and you can convert between them with tg_to_geojson(), tg_to_wkb(), and tg_to_wkt().

select tg_to_geojson('POINT(1 2)');
-- '{"type":"Point","coordinates":[1,2]}'

select tg_to_wkb('POINT(1 2)');
-- X'0101000000000000000000f03f0000000000000040'

select tg_to_wkt('{"type":"Point","coordinates":[1,2]}');
-- 'POINT(1 2)'

Documentation

See docs.md for a full API reference.

Installing

LanguageInstall
Pythonpip install sqlite-tgPyPI
Datasettedatasette install datasette-sqlite-tgDatasette
sqlite-utilssqlite-utils install sqlite-utils-sqlite-tgsqlite-utils
Node.jsnpm install sqlite-tgnpm
Denodeno.land/x/sqlite_tgdeno.land/x release
Rubygem install sqlite-tgGem
Github ReleaseGitHub tag (latest SemVer pre-release)
sqlite
sqlite-extension

Contributors

asg017

165 commits

simonw

2 commits

Languages

C

59.7%

Python

22.8%

HTML

12.7%

Makefile

3.7%