MatErW3len
MatErW3len

Reputation: 64

Why do my SpatiaLite queries return 'no such function: GeomFromText'?

I port SpatiaLite to Android for a .NET MAUI application. I compiled [email protected] into libspatialite.so and used the following configurations to replace SQLite with libspatialite.so:

SQLitePCL.SQLite3Provider_dynamic_cdecl.Setup("libspatialite", new CustomSqliteAdapter("libspatialite"));
SQLitePCL.raw.SetProvider(new SQLite3Provider_dynamic_cdecl());

I can run queries that an SQLite engine should. However, SpatiaLite queries do not work:

var insertQuery = @"
INSERT INTO places (name, geom)
VALUES (?, GeomFromText(?, 4326));";

var pointWKT = $"Point({-122.4194} {37.7749})";
await connection.ExecuteAsync(insertQuery, "Sample Point", pointWKT);

I get:

MauiSqlite.SQLite.SQLiteException: 'no such function: GeomFromText'

Upvotes: 0

Views: 85

Answers (0)

Related Questions