Example usage: I have a spatialite layer which contain my fiber optic cable routes. In that layer there is a column named 'Cable types' with coded integer data: 1 for aerial cable, 2 for underground cable... Now I want to send the spatialite database to a colleague. Is there anyway to preserve the meaning (description) of cable types without having to send the QGIS style file for that layer?


A couple of options:

  1. Create a non-spatial table called Cable Type in the spatailite database to store the interger and the value.
  2. Do 1. but create a view that joins the two tables together so your colleague gets the cable type name rather then the integer.
| improve this answer | |
  • Thanks for your answer but my colleague is not a specialist in GIS or database user, so I want it to be simplest possible for him and others to retrieve that data. In this case, I think it would be best if I can embed into the layer metadata (my colleague just have to select metadata tag in the layer properties). Do you know any way that is as simple as the one I thought of? – Cao Minh Tu Apr 8 '12 at 15:14

I don't think you need to bother with style files. If all of the project data is in a Spatialite database all you should need to do is send your colleague the database together with your QGIS project file (*.qgs). When your colleague opens the *.qgs file in QGIS the project should load, showing exactly the view that you saved, with the styles, labelling and so on, intact. For this to work, before you save the project you need to ensure that the *.sqlite file and the *.qgs file are in the same directory and that you save the project using relative addressing (I think this is the default nowadays).

Proof of concept (140 MB):



| improve this answer | |
  • Hi Nick, I think I will employ 2 of your techniques: 1. 1st one in your previous answer - that to remind myself in case I forget after some time and the project file may be corrupted 2. your second answer - for a quick and easy solution for my colleague. Thank you for your answers - that helps alot. – Cao Minh Tu Apr 16 '12 at 10:30
  • 1st point is from the answer of Nathan W, 2nd point is from your (nhopton) answer. Sorry for my mistake! – Cao Minh Tu Apr 17 '12 at 3:45

Why not just add an extra column, call UPDATE on the table for each integer value to set that column's value to some text matching the table, and then ship the result.

| improve this answer | |

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.