Spatialite for Cordova / Ionic / Javascript

389 views
Skip to first unread message

John Calderaio

unread,
Oct 18, 2015, 4:36:53 PM10/18/15
to SpatiaLite Users
I'm trying to make an app using Spatialite using cordova / ionic. I've successfully gotten SQLite to work with cordova, but how would I now use Spatialite?

a.fu...@lqt.it

unread,
Oct 18, 2015, 6:30:14 PM10/18/15
to spatiali...@googlegroups.com
Hi John,

I completely ignore anything about cordova and ionic.
What I can say in very general terms is that on any platform
I know you are always required to load SpatiaLite as an extension
to SQLite immediately after opening a new DB connection.

Technically speaking SpatiaLite is a dynamically loadable binary
(i.e. it's a .DLL on Windows, a .so on Linux, a .dylib on Mac):
once you've successfully loaded the SpatiaLite extension then
your SQLite DB connection will acquire the magical superpowers
of Spatial Processing.

the process usually requires the following steps:

#1. you have to install first the appropriate executable module(s)
for your target platform (this including any related dependency).
this step is strongly platform-dependent.

#2. then your program / application has to actually load the extension
module; nothing really difficult, it just requires executing an
SQL statement like this:

SELECT load_extension('mod_spatialite');

#3. if you are a lucky man anything will work in the nicer way;
sometimes it will fail reporting some cryptic error message.
it's absolutely platform specific, so I'm completely unable to
foresee what could eventually happen on cordova / ionic.
just try and eventually report your further findings.

have good luck,
Sandro

G. Allegri

unread,
Oct 19, 2015, 4:58:10 PM10/19/15
to spatiali...@googlegroups.com

Ionic doesn't play any role here, as you probably know.
For Cordova I fear you will have to bundle a custom sqlite build specifically for spatialite, which means a custom plugin for Cordova is probably required.
I don't know iOS enough but for Android give a look at https://github.com/geopaparazzi/libjsqlite-spatialite-android.

Keep in mind that heavy processing should probably fit in a native code plugin. A mobile browser doesn't provide the same resources and performances of a desktop browser.

giovanni

--
You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spatialite-use...@googlegroups.com.
To post to this group, send email to spatiali...@googlegroups.com.
Visit this group at http://groups.google.com/group/spatialite-users.
For more options, visit https://groups.google.com/d/optout.

G. Allegri

unread,
Oct 19, 2015, 5:00:39 PM10/19/15
to spatiali...@googlegroups.com

Sorry, I didn't mean a sqlite build but a sqlite library to intervace the plugin's native code and sqlite/spatialite...

Reply all
Reply to author
Forward
0 new messages