Migrating spatialite 3 databases to spatialite 4 database

41 views
Skip to first unread message

aidan murphy

unread,
Jul 29, 2015, 12:43:08 PM7/29/15
to SpatiaLite Users
I am trying to migrate several databases containing user entered geometry data from a spatialite 3 db to spatialite 4.  If I run InitSpatialMetaData in my migration scripts I receive errors saying that certain metadata columns already exist.  There is no function to De-InitSpatialMetaData, so my thought was to drop all the spatialite meta data tables individually, then run InitSpatialMetaData, and then use RecoverGeometryColumn to grab all my metadata again.  I ran a simple test and it seems to have worked.  Though there is a very discerning message I read that says Directly performing INSERTUPDATE or DELETE on their behalf is a completely unsafe and strongly discouraged practice.  

Is there some other safer way to do this?

Thank you!

a.fu...@lqt.it

unread,
Jul 29, 2015, 12:58:28 PM7/29/15
to spatiali...@googlegroups.com
On Wed, 29 Jul 2015 09:43:08 -0700 (PDT), aidan murphy wrote:
> Is there some other safer way to do this?
>

Hi Aidan,

there is a specific spatialite-tool exactly intended to support any
format conversion between different versions in the safest way.

https://www.gaia-gis.it/fossil/libspatialite/wiki?name=switching-to-4.0#convert

bye Sandro

Pac

unread,
Jul 30, 2015, 3:01:04 AM7/30/15
to SpatiaLite Users, a.fu...@lqt.it
Hi Aidan,

After upgrading your metadata tables with spatialite_convert (it works like a breeze), you should consider to update its statistics tables (https://www.gaia-gis.it/fossil/libspatialite/wiki?name=metadata-4.0) executing UpdateLayerStatistics function (look for it in http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html#p16).

Regards,
Paco.
Reply all
Reply to author
Forward
0 new messages