0

I use the Python sqlite3 library as well as the SQLite3 CLI. I am also using the Distance function with the use_ellipsoid parameter, to get the distance between two geometries in meters.

Whenever the geometries touch, I get NULL instead of 0.0 m distance. The exact value of use_ellipsoid does not matter.

An example:

.load 'mod_spatialite.so'
SELECT InitSpatialMetaData(1);
SELECT DISTANCE(MakePoint(13.41, 52.525), MakePoint(13.41, 52.525), 1);

It just returns NULL, respectively, None in Python. If I change one of the points, everything seems to work fine, so it is not a CRS issue.

Is this supposed to be like this? Am I doing or expecting something wrong?

1

What is your SpatiaLite version? The query works for me with SpatiaLite 5.0.0-beta0 but not with version 4.3.0a.

enter image description here

4
  • Indeed, I run libspatialite 4.3.0a. The fact that it works with 5.0.0 beta is interesting. – Heap Underflow Apr 29 '20 at 21:47
  • SpatiaLite is a project that is under continuous development. It might be good if the list of the SQL functions had a field to tell since which version the newest functions are available. This list gaia-gis.it/gaia-sins/spatialite-sql-latest.html, despite the title of the page, has many functions which were not in 4.3.0. – user30184 Apr 30 '20 at 7:27
  • I edited my question to contain a more precise link to the docs for 4.3.0. However, this changes nothing about my expectations towards Distance. I'll consider this as a bug then. – Heap Underflow Apr 30 '20 at 17:09
  • It may be a bug but I do not believe that it will be fixed ever into the 4.3 version. – user30184 Apr 30 '20 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.