Using the spatial extension for SQLite on Windows

I know that this was set in a similar way before. However, all the questions I found on this related to some very specific system settings that were not applicable to me (because it is).

System:

  • Windows 7 64bit
  • Python 3.4 64bit
  • sqlite3 2.6.0 (comes with Python, I think)
  • Windows Spatialite 2.3.1 sections (anything else important?)

How to activate spatialite extension for sqlite3 module?

What I tried (as other people say in similar questions):

  • Download from https://www.gaia-gis.it/spatialite-2.3.1/binaries.html :
    • libspatialite-win-x86-2.3.1.zip
    • proj-win-x86-4.6.1.zip
    • geos-win-x86-3.1.1.zip
    • libiconv-win-x86-1.9.2.zip
  • unzip all of them into the same folder in C: \
  • (also tried only putting DLLs in this folder)
  • put this folder in my system PATH variable

Then by running

 import sqlite3 conn = sqlite3.connect(":memory:") conn.enable_load_extension(True) conn.execute('SELECT load_extension("libspatialite-2.dll")') 

gives

 conn.execute("SELECT load_extension('libspatialite-2.dll')") sqlite3.OperationalError: The specified module could not be found. 

The more I can try to do this job?

+5
source share
1 answer

you probably don't have the folder in which libspatialite-2.dll is placed in your PATH. Perhaps you can add a folder from your Python script (I don't know any Python). Or you can add it from the windows properties interface.

By the way, you are using a very old version of spaceite: look here for newer versions: https://www.gaia-gis.it/fossil/libspatialite/index

+4
source

Source: https://habr.com/ru/post/1210924/


All Articles