[fpc-pascal] Spatialite (a GIS extension to Sqlite) & SQLite Load_extension

Reinier Olislagers reinierolislagers at gmail.com
Mon Nov 7 08:23:52 CET 2011


Hi all,

I'm looking into getting road, vegetation, building etc. data from
OpenStreetmap and generating a map for the Rigs of Rods
truck/driving/flight/boat simulator.... using FPC/Lazarus if possible.

I've found Spatialite [1], an extension to the SQLite database engine,
that allows e.g. easy import of Openstreetmap data, routing, and
coordinate conversion (I intend to convert the WGS 84 coordinates into a
flat coordinate system).

1. Has anybody used spatialite within FreePascal/Lazarus? Any
hints/tips/example programs I can stea... use?

2. You can apparently load the spatialite (and dependencies) dll/so as
an extension to SQLite, with a statement like [3]
select load_extension('libspatialite-4.dll');
However, it seems you have to enable the extension load mechanism first
using the C API [2]:
int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
(onoff==1 to turn extension loading on)
Is there support for this within FPC?
I found sqlite3_enable_load_extension within
packages/sqlite/src/sqlite3.inc, but it doesn't seem to be used...
Would I need to edit sqlite3conn.pp to add support for loading extensions?


Thanks,
Reinier

[1] http://www.gaia-gis.it/spatialite/index.html
[2] http://www.sqlite.org/c3ref/enable_load_extension.html
[3] http://www.sqlite.org/lang_corefunc.html#load_extension



More information about the fpc-pascal mailing list