0

I am am trying to use spatialite plugin from https://github.com/DisyInformationssysteme/Cordova-spatialite-storage

for my cordova application,

but the problem is that when i try to create database it shows me

Database open failed, aborting any pending transaction.

I dig a lot for alternative solution for using spatial feature, but unfortunately couldn't succeed.

  • Have you ever heard of http://brian.io/lawnchair ? I use that in all my Cordova apps - its very simple to use and works great – lulu88 May 27 '16 at 11:59
  • I wanted to store my data in table and also want one spatial column to store geometries that is the main reason to use this plugin. and i think your solution will help to store objects as local. – Hemal Gondaliya May 27 '16 at 12:28

1 Answers1

0

We had the same problem but it looks like we managed to find a workaround. It seems that Cordova-spatialite-storage plugin has some issues with opening/creating a database if database does not already exist. If database exists, you should be fine but only if you also added cordova-plugin-file plugin.

Try these steps:

  1. copy existing spatialite database to device (e.g. file:///storage/emulated/0/Download/database.sqlite - just for the sake of testing, later you should move it to more appropriate location)
  2. add cordova-plugin-file plugin
  3. check if cordova-plugin-compat plugin is also added
  4. add cordova-spatialite-storage plugin

Try to open database with name: 'file:///storage/emulated/0/Download/database.sqlite' and run some spatial queries. It should work. Please let me know how it went.

damirko
  • 44
  • 1
  • 3