Skip to content

Load spatialite extension? #267

Closed
Closed

Description

@giumas

Can I load the spatialite extension module? I have attempted using "Load extension" but I got "Error loading extension: The specified module could not be found".

Activity

  1. justinclift commented on Apr 21, 2015

    @justinclift
    Member

    As a thought, which OS are you using, and which version of DB4S and the SpatiaLite extension? (not sure if it makes a difference, but it's helpful to know)

  2. giumas commented on Apr 21, 2015

    @giumas
    Author

    I am on Win7 x64. For the DB4S (x86) version, I attach a screenshot with the about:
    dbbrowser_version

    For the spatialite extension, I am using the last stable (4.2.0): http://www.gaia-gis.it/gaia-sins/windows-bin-x86/

    I am not sure that I am properly using the application .. I was not able to find documentation on the "load extension". However, to reproduce my error, I open DB4S, then I create a dummy table and I try to "load extension" selecting the dll in a folder where I unzipped the 7z archive:

    dbbrowser_error

  3. justinclift commented on Apr 21, 2015

    @justinclift
    Member

    Hmmm yeah, I'm not sure either. @MKleusberg or @rp- may know more... 😄

  4. green3g commented on May 11, 2016

    @green3g

    I'm having this problem also. I am trying to load the ST_Geomtry extension for ArcGIS:

    http://desktop.arcgis.com/en/arcmap/latest/manage-data/databases/spatially-enable-sqlilte.htm

    I've added all the PATH's and the command works via command line sqlite3, but not in the browser.

  5. justinclift commented on May 11, 2016

    @justinclift
    Member

    Hmmm, as a thought, is the extension a .dll file? If so, copying it into the same directory as the sqlitebrowser.exe file might let it be found.

    No guarantees, but it's worth a shot. 😄

  6. jimothyr commented on Aug 9, 2016

    @jimothyr

    I am having the same problem. I have tried the same directory approach , and no dice..

    Win7 x64 db version 3.8.0

  7. justinclift commented on Aug 9, 2016

    @justinclift
    Member

    Thanks @jimothyr. It sounds like we should investigate this properly after the 3.9.0 release (which is due any day now).

  8. zhm commented on May 1, 2017

    @zhm

    I ran into this same issue and I finally got it to work. It has to do with the library search paths on Windows because mod_spatialite in turn loads its own dependent DLLs that reside in the same directory as mod_spatialite.dll.

    I got it working 2 different ways:

    1.) Add the directory containing the spatialite .dll files to your %PATH%. Windows searches %PATH% for dll files so it will be able to locate it.
    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 sqlitebrowser you have.

    This works because Windows searches for .dll files in %PATH% and the current application directory. So putting them in either place works.

    If mod_spatialite were shipped as fat binary containing everything in a single dll file I don't believe this would be necessary and it would just work pointing it at the dll, but until then we have to make sure all of the .dll's are located somewhere Windows will search when loading shared libs.

  9. justinclift commented on May 1, 2017

    @justinclift
    Member

    @zhm That's pretty awesome. 😄

    Any interest in cutting-n-pasting that into a wiki page, for better visibility of the info? It's seems like pretty arcane knowledge that others would definitely benefit from.

  10. zhm commented on May 1, 2017

    @zhm
  11. zhm commented on May 1, 2017

    @zhm

    I think this issue can be closed because it's definitely not an issue with DB4S. I don't believe there's anything to be done other than making a more location-independent build of mod_spatialite.

  12. 36 remaining items

  13. barbalex commented on Apr 8, 2021

    @barbalex

    @chrisjlocke Yeah, makes sense.

    Sqflite uses whatever the platform (Android, iOS) provides (tekartik/sqflite#70 (comment)). I am not sure if it will be possible to load spatialite under these circumstances, even if dart:ffi seems to let me run c code. Will have to try, I guess.

  14. stuartong commented on May 13, 2021

    @stuartong

    @chrisjlocke I did the steps you described, saved and ran Select spatialite_version() but i got an error saying its not loaded and it won't 'persist' as an extension - disappears every time I close db browser

  15. chrisjlocke commented on May 13, 2021

    @chrisjlocke
    Member

    You're loading it in the preferences section, as per this comment?
    #267 (comment)

  16. stuartong commented on May 18, 2021

    @stuartong

    @chrisjlocke yes i followed those steps but was unable to load the extension

  17. chrisjlocke commented on May 18, 2021

    @chrisjlocke
    Member

    but was unable to load the extension

    Can you send a screenshot of the error you get? What operating system are you using? What DB4S version are you using?

  18. ThoKau commented on Aug 1, 2021

    @ThoKau

    Doesn't work here, same error as mentions 100s of times before.
    Testing with nighly DB4S-version and Spatialite 5.0.1 on Win 8.1 64.
    Copied all dll files from MinGW-DL in all 3 possible folders, tried 32, 64, 32 in 64. Nothing works.
    3.12.2 also doesn't work.
    After copying all files to all folder with all renames and 32+64bit it ended up with a error and missing entry point in libgeos-3-9-0.dll.
    Maybe someone could zip all 100s of necessary dll files to put them all into DB4S-folder to solve this annoying incompatibilties of DB4S, Spatialite, SQLite, OS4Geo, MinGW, Windows and all the other programs you need to do the very first steps.

  19. justinclift commented on Aug 1, 2021

    @justinclift
    Member

    Ok, it sounds like we'll need some assistance from a specialist that knows GIS stuff.

    @sandman7920 Are you able to help out here, and get things working? 😄

  20. sandman7920 commented on Aug 2, 2021

    @sandman7920
    Contributor

    @ThoKau if you are ok with spatialite-4.3.0a please look at #2538

    You need to copy all dependencies into DB4S root folder or somewhere in the system path
    dependencies:

    geos_c.dll
    geos.dll
    iconv.dll
    libxml2.dll
    lwgeom.dll
    proj_6_3.dll
    

    Then mod_spatialite.dll should be loaded without problem.

  21. chrisjlocke commented on Aug 2, 2021

    @chrisjlocke
    Member

    I'll fire up a Win 8.1 virtual machine and have a look.

  22. chrisjlocke commented on Aug 2, 2021

    @chrisjlocke
    Member

    @ThoKau - Does it need to be Spatialite 5.0.1 - seems the osgeo4w files only go to 4.3.0a

  23. ThoKau commented on Aug 2, 2021

    @ThoKau

    @sandman7920: Thanks!! freexl.dll from #2538 was missing, and libfreexl-1.dll too, at least for me.
    After adding those 8 files to DB4S-folder and copying all mod_spatialite-files too, it seems to run with latest versions.

    Lib versions shown in DB4S 3.12.99:
    FreeXL 1.0.6
    GEOS 3.9.0-CAPI-1.16.2
    LibXML2 2.9.10
    Proj Rel. 7.2.1, January 1st, 2021
    Proj4 Rel. 7.2.1, January 1st, 2021
    RTTopo 1.1.0
    SQLite version: 3.36.0
    Spatialite: 5.0.1
    spatialite_target_cpu x86_64-w64-mingw32

    SELECT 'SQLite version:' AS Lib, sqlite_version() AS Version
    UNION SELECT 'Spatialite:', spatialite_version()
    UNION SELECT 'GEOS', geos_version()
    UNION SELECT 'spatialite_target_cpu', spatialite_target_cpu()
    UNION SELECT 'FreeXL', freexl_version()
    UNION SELECT 'Proj', proj_version()
    UNION SELECT 'Proj4', proj_version()
    UNION SELECT 'RTTopo', rttopo_version()
    UNION SELECT 'LibXML2', libxml2_version()

  24. chrisjlocke commented on Aug 3, 2021

    @chrisjlocke
    Member

    @ThoKau - Where did you get the 5.0.1 files from? I could only (albeit from the link above) see the older 4.3 version. I saw the source files for 5.0.1 - did you compile it yourself? If so, could I be sneaky and ask if you could 7zip the files and email them to me?

  25. ThoKau commented on Aug 3, 2021

    @ThoKau
  26. sandman7920 commented on Aug 5, 2021

    @sandman7920
    Contributor

    @ThoKau now you have a mixture between MinGW/MSVC C/C++ runtime and sqlite3.dll/libsqlite3-0.dll DB4S/gaia-sins

    osgeo4w provides v2 repo which contains version 5.0.1 of the mod_spatialite.

  27. sandman7920 commented on Aug 5, 2021

    @sandman7920
    Contributor

    OSGeo4W mod_spatialite-5.0.1 dependencies:

    mod_spatialite.dll
    
    freexl.dll
    geos_c.dll
    geos.dll
    iconv-2.dll
    jpeg12.dll
    jpeg.dll
    libcurl.dll
    liblzma.dll
    librttopo.dll
    libxml2.dll
    proj_8_0.dll
    proj.db
    tiff.dll
    zlib.dll
    zstd.dll
    

    Optionally if don't have msvcrt2019 and OpenSSL installed system-wide you can get them from v2 repo

    If you don't want to pollute the DB4S folder with external libraries (easy update for both DB4S and mod_spatialite),
    create a new folder for example D:\mod_spatilite, copy all libraries there, and add the folder to the user or system path.

    DB4S_env

    Then load mod_spatialite.dll from the newly created folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions