Tuesday, January 6, 2015

How to properly create spatialite data for geopaparazzi

This has been asked quite some times and too often people complain about the fact that spatialite databases created in QGIS are not visible in Geopaparazzi.

I know, I also wish it was always simple and straight forward.

What I can do right now, is to show you the procedure I follow to create vector data to work with in geopaparazzi. It uses Spatialite-GUI though, not QGIS.

1) Download the Spatialite-gui

You can find it on the spatialite homepage, at the time of writing a good version for windows is version 1.7.1 available in this download area.

Open it and find yourself with:

2) Create a new empty database in which to load the shapefile data

You will be asked to save the database somewhere on disk. Once done, you should find yourself with something like this, but with different path:

3) Load the shapefile

To do so locate the Load Shapefile icon:

In this example I will import a set of shapefiles from the Natural Earth dataset, in particular the following onces:

that can be found here.

The import dialog is the important one to fill the right way:

The really important things to take care of, are underlined in red:

  1. the SRID, i.e. the EPSG code of the data projection. If that one is not right, then you will not be able to see the data in geopaparazzi. Don't even hope in miracles!
  2. the Charset Encoding. Make sure to choose the right one. For example Japanese people might want to choose SHIFT_JIS if they want to see the labels rendered properly
  3. force the creation of the spatial index
If you then the push the ok button, you should find yourself with an ok message like this after the import:

You are almost there, one last step to go.

Right-click on the database name and select the Update Layer Statistics command.

Depending on the amount of data it should keep your harddisk working for a bit. Don't think it finished unless you see a result like the following:

Once this result appears to you, you are good to go.

Move the spatialite database to your device, fire up geopaparazzi and go directly to the spatialite data view (from the mapview).

You should see something like:

Enable the countries and places layer, maybe also activate the labels for the places layer. And voila'!

This has always worked for me. I hope it will solve any issue people might have.

No comments: