refactorize location.spatialite.db related operation out to standalone module and tested.