MBTILES Layers not released

classic Classic list List threaded Threaded
4 messages Options
AndreaB AndreaB
Reply | Threaded
Open this post in threaded view
|

MBTILES Layers not released

Hello Everyone,

I'm stuck in a problem similar to this: http://forum.osgearth.org/Deleting-source-files-for-removed-image-layers-td7586938.html#a7586939

I successfully add and remove image layers from the Map, however I need to be able to "unlock" the relative file on my system in order to (e. g.) remove or rename it.

Everything works fine if I use image layers using the GDAL driver (e. g. *.tif), however image layers that uses MBTILES are removed from the map but I cannot remove the file from disk until I close the whole application (which is not desired).

In the above link I read that in an older version of osgEarth the problem was that the sqlite database was not closed. However it seems to me that the database is not closed even in the most recent 3.1 version.

How can I unlock the *.mbtiles file after removing the corresponding layer from the map?

I'm using osgEarth 2.10.1 built with MSVC2015 x64.

Many thanks in advance for your support.

Best regards.

Andrea
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: MBTILES Layers not released

Thanks for the report, I've opened a Github issue to track this
https://github.com/gwaldron/osgearth/issues/1738
AndreaB AndreaB
Reply | Threaded
Open this post in threaded view
|

Re: MBTILES Layers not released

Many thanks Jason. I stay tuned on this topic.

Thanks again. Best regards.

Andrea
AndreaB AndreaB
Reply | Threaded
Open this post in threaded view
|

Re: MBTILES Layers not released

Hello everyone,

I've implemented a very little patch that seems to work (at least in my application). Since I'm using version 2.10.1 I've modified the class MBTILESTileSource by adding an explicit destructor in the header. Inside the destructor i simply call the method

sqlite3_close_v2(_database);

That's all.

From an initial set of tests on my application it seems that with this patch the MBTILES files are unlocked after these have been removed from the map.

Hope this helps.

Many thanks.

Andrea