comments 14

How to install SpatiaLite and SpatiaLite GUI on Ubuntu 12.04

I‘ve recently needed a spatial database for storing a large amount of point data. I first thought about PostGIS but was turned off by its Client-Server-Architecture which seemed a too big overhead for my small task. On the other hand, I already had a SQLite database running and was thus familiar with its lightweight approach. Thus I decided to try out SpatiaLite, which, like PostGIS, supports the OpenGIS specifications.

Installing all the latest versions of the SpatiaLite family on Ubuntu 12.04 turned out to be a bit tedious though. As of today, these are SpatiaLite 4.0.0 and SpatiaLite GUI 1.6. I had to compile everything from source and was often thrown back just to learn that I need to install all the *-dev versions of the needed C libraries as well.

There actually are packaged versions of SpatiaLite and SpatiaLite GUI in the package system of Ubuntu, but they are often a version or more behind the actual version.

Therefore this post will give an easy, copy-paste style how-to for compiling SpatiaLite and its GUI with all the dependencies.

SpatiaLite 4

First you need to have all the dev versions of the libraries SpatiaLite depends on:

Although you might not need it, you should install FreeXL since it is definitely needed by the GUI, and I ran into problems when I chose not to install it in the first place.

Then, to install the main package (maybe you have to add --disable-freexl after ./configure if this doesn’t work, it used to work for me, see comments below):

You should also install the command line utility (similar to the SQLite utility) and other helpful tools. In my case, I didn’t need OSM support, so I disabled it.

In order for everything to work, you need to register the path to the binaries like this: Open up ld.so.conf with a text editor

and add

at the end of that file. After that, refresh:

If you don’t want the GUI, you’re done and can invoke the CLI via

If you want the GUI, follow these steps…

SpatiaLite GUI 1.6

Again, you need to install dev versions of required libraries:

You really need FreeXL for the GUI, so if you haven’t installed it yet, you might just as well start from scratch. Apart from that, you’ll need libgaiagraphics

Finally, you can install the GUI with

There you go!

14 Comments

  1. rohan

    how do i use the spatialite installation in my java code …which extension do i load for spatialite function
    addGeometry() ..(LINUX …..ubuntu )

    but normally in windows i tried this and it worked for windows but nt for UBUNTU

    stmt.execute(“SELECT load_extension(‘libspatialite.dll’)”);
    stmt.execute(“SELECT InitSpatialMetaData()”);

  2. Pietr

    Second part
    ./configure make -j8
    should be in two lines:
    ./configure
    make -j8

    I got also
    “shell.c:2525: undefined reference to `load_XL'”
    when compiling spatialite-tools-4.0.0, in command
    sudo make install-strip

  3. Pingback: Installing on Linux – SpatiaLite Talk

Leave a Reply