Skip to content

SpatiaLite on Windows

Chris Locke edited this page Apr 7, 2021 · 7 revisions

It's possible to use SpatiaLite on Windows by downloading the official mod_spatialite binaries. You can download the binaries at the bottom of the page here.

Direct download links:

Because the mod_spatialite library was built as multiple DLLs, you have to make sure Windows can find all of them. DB4S will load an absolute path to the mod_spatialite.dll, and mod_spatialite.dll in turn loads the rest of the shared libraries like libgeos_c-1.dll, libproj-9.dll and others. In order to find these dependent .dll's, they must be located in a directory Windows will search.

There are 2 different ways to get it to work:

  1. Add the directory containing the .dll files to your %PATH%. Windows searches %PATH% for dll files so it will be able to locate all of them. This has the side-effect of any program being able to use them.
  2. Copy the .dll files to the same directory containing DB Browser for SQLite.exe. e.g. C:\Program Files\DB Browser for SQLite or C:\Program Files (x86)\DB Browser for SQLite whichever version you have installed (32bit or 64bit).

You will also want to make sure you use the correct x86 or x64 dll files that correspond to the version of DB4S you have.

Alternative instructions, with screenshots

Workaround for Windows 10 failure

If you're using Windows 10 and the SpatiaLite extention fails to load, there is a workaround:

Win10 fail

As @karim points out, Spatialite includes an older version of libstdc++-6.dll, which works fine in Windows 7 but not Windows 10.

This file comes from MinGW, the compiler they use to build the extension. Replacing it with a newer version works.

  1. Delete libstdc++_64-6.dll from DB4S folder
  2. Go to https://sourceforge.net/projects/mingw-w64/files/ and download one of x86_64-win32-seh files
    • Or use this direct link here
  3. Extract it somewhere and look into the bin folder
  4. Copy both libstdc++-6.dll and libgcc_s_seh-1.dll to DB4S folder
  5. Rename libstdc++-6.dll to libstdc++_64-6.dll
  6. Try to load the module again. This time it should work.

Credit goes to http://blog.jrg.com.br/2016/04/25/Fixing-spatialite-loading-problem/

Clone this wiki locally