I have an ionic – angular – capacitor app with a map, drawn by openlayers using vector tiles from different online sources (mapbox, tomtom or openstreetmap). I try to add the possibility to use a set of offline vector openstreetmap tiles (necat.mbtiles) that I copy to the Documents forlder of an android device.
After dealing with permissions, I try to open the mbtiles database, but I don’t manage it:
async openDatabase() {
try {
const path = await this.getDatabasePath();
console.log(path);
this.db = await this.sqlite.create({
name: path,
location: 'default',
});
console.log('Database opened successfully');
} catch (error) {
console.error('Error opening database', error);
}
}
I get the error Error opening database Error: Could not open database
The database path is OK. I reduced the geographic coverage of the database in order to lower the file size from 600 MB to 60MB, but the result is the same