2

I'm trying to install Spatialite on a CentOS 7 server.

Sqlite (version 3.7.17 ...), works fine.

Using the command

yum list | grep spatial

the result is the follow

enter image description here

So I've installed Spatialite using the command

sudo yum install libspatialite

When I try to check abot spatialite version I obtain ...

enter image description here

If I search for "spatial" libraries in my system I obtain ...

enter image description here

Any suggestions?

6
  • Pehaps you have not set "enable_load_extension" into "True" before trying to load mod_spatialite. – user30184 Sep 9 '18 at 18:23
  • Where should I set it? – Cesare Sep 9 '18 at 21:06
  • It depends on how you connect the SQLite db. Some examples can be found here groups.google.com/forum/#!topic/spatialite-users/93eFMPty05k. SQLite documents may also be useful sqlite.org/c3ref/enable_load_extension.html. And stackoverflow may help as well because you have a generic SQLite problem that is not specific to SpatiaLite module. You may even need to recompile, see the footnote in: docs.python.org/3/library/sqlite3.html#f1. – user30184 Sep 9 '18 at 21:12
  • At the momenti I'm trying simply to connect from command line but it doesn't work .... – Cesare Sep 10 '18 at 16:14
  • Sorry for being blind. You try to load mod_spatialite but you do not seem to have mod_spatialite.so in your system. What you need to install is maybe libsqlite3-mod-spatialite. – user30184 Sep 10 '18 at 17:11
1

I've solved ...

I don't have to use mod_spatialite but libspatialite.so.5...

In my system ..

# find /  | grep mod_spatialite

is empty but ...

# find /  | grep libspatialite
/usr/lib64/libspatialite.so.5
/usr/lib64/libspatialite.so.5.1.0

So, I've tried in this way ....

# sqlite3 test
sqlite> select load_extension('/usr/lib64/libspatialite.so.5');
sqlite> select spatialite_version();
4.1.1

You can set

# export "LD_LIBRARY_PATH=/usr/lib64" 

so, in more simply way ...

# sqlite3 test
sqlite> select load_extension('libspatialite.so.5');
sqlite> select spatialite_version();
4.1.1
sqlite> select InitSpatialMetaData();
sqlite> select distance(makepoint(151.23346, -33.91674, 4326),        makepoint(151.20435, -33.86712, 4326));
0.0575285711625093

So, it seems that spatialite works fine!

4
  • Good if it works for you. However it should be possible to get also the mod_spatialite.so but I do not know how. This RedHat RPM build contains them both rpm.pbone.net/index.php3/stat/4/idpl/29688382/dir/redhat_el_6/…. – user30184 Sep 10 '18 at 20:15
  • Yes on RedHat is differentm but I'm on CentOS7 ... – Cesare Sep 10 '18 at 20:18
  • 1
    By danielmiessler.com/study/fedora_redhat_centos CentOS is basically RedHat without support. What is possible with RedHat should be possible with CentOS as well but you might need to compile by yourself. If you really want to know how it should be done write mail to SpatiaLite users forum. Sandro Furieri and some other specialists tends to be responsive. – user30184 Sep 10 '18 at 20:24
  • Worked like a charm on centos 7. Thanks for this answer :) – Sverrir Sigmundarson Jan 3 '20 at 21:51

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.