Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More detailed information about installed SpatiaLite version #1607

Closed
simonw opened this issue Jan 20, 2022 · 2 comments
Closed

More detailed information about installed SpatiaLite version #1607

simonw opened this issue Jan 20, 2022 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Jan 20, 2022

https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.0.0.html#version has a whole bunch of interesting functions for things like freexl_version() and geos_version() and HasMathSQL() and suchlike.

These could be shown on the /-/versions page.

@simonw
Copy link
Owner Author

simonw commented Feb 2, 2022

Prototype:

diff --git a/datasette/app.py b/datasette/app.py
index 09d7d03..e2a5aea 100644
--- a/datasette/app.py
+++ b/datasette/app.py
@@ -724,6 +724,47 @@ class Datasette:
                     sqlite_extensions[extension] = None
             except Exception:
                 pass
+        # More details on SpatiaLite
+        if "spatialite" in sqlite_extensions:
+            spatialite_details = {}
+            fns = (
+                "spatialite_version",
+                "spatialite_target_cpu",
+                "rcheck_strict_sql_quoting",
+                "freexl_version",
+                "proj_version",
+                "geos_version",
+                "rttopo_version",
+                "libxml2_version",
+                "HasIconv",
+                "HasMathSQL",
+                "HasGeoCallbacks",
+                "HasProj",
+                "HasProj6",
+                "HasGeos",
+                "HasGeosAdvanced",
+                "HasGeosTrunk",
+                "HasGeosReentrant",
+                "HasGeosOnlyReentrant",
+                "HasMiniZip",
+                "HasRtTopo",
+                "HasLibXML2",
+                "HasEpsg",
+                "HasFreeXL",
+                "HasGeoPackage",
+                "HasGCP",
+                "HasTopology",
+                "HasKNN",
+                "HasRouting",
+            )
+            for fn in fns:
+                try:
+                    result = conn.execute("select {}()".format(fn))
+                    spatialite_details[fn] = result.fetchone()[0]
+                except Exception:
+                    pass
+            sqlite_extensions["spatialite"] = spatialite_details
+
         # Figure out supported FTS versions

@simonw simonw added this to the Datasette 1.0 milestone Feb 9, 2022
@simonw simonw closed this as completed in 458f03a Feb 9, 2022
@simonw
Copy link
Owner Author

simonw commented Feb 9, 2022

simonw added a commit that referenced this issue Mar 20, 2022
simonw added a commit that referenced this issue Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant