I added to my SpatiaLite table (.osm-import with the "standard" QGIS-OSM-Plugin) two empty columns x and y (double) to define manually the position of my labels (data defined labeling). But after telling the layer about the x and y-column, all labels just disapears!

I tested it in different CRS and with different data types and lengths. I created the columns in QGIS (When I create them in DB-Manager or Qspatialite, they wont appear in the QGIS attribute table)

Im absolutely new to SQL databases!

Thats my table: enter image description here

enter image description here


Creating a column with

ALTER TABLE "pelepo_300114_place" ADD COLUMN label_x integer

works but is NOT displayed in Qgis. (I tryed it with integer, numeric, float...)

  • I would like to change the question, because the main problem is not the labeling (as we fould out now). Its the fact that my new columns are just not displayed in qgis. – MAP Feb 1 '14 at 15:39

You say you are defining two empty columns X and Y of type double, but on the screenshots they appear as integers. Also, there is no double type as numeric on sqlite:

Which version os spatialite are you using?

Can you add the columns with an sql command with the shell?

  • SQLite version: 3.7.9; SpatiaLite Library: 4.1.0; I created the columns with [ALTER TABLE "pelepo_300114_place" ADD COLUMN label_x integer] – MAP Jan 31 '14 at 20:29

This is certainly related to this bug: http://hub.qgis.org/issues/9148

Basically, in database tables, you can't use a null value for default coordinates when using doubles (or equivalent). Look into the issue tracker to find out why.

My workaround is to use string for those X and Y label coordinates. QGIS handles null/empty strings as you expect, meaning that default values don't need to be manually entered.

  • Thank you but thats not the problem. I tryed it with strings also. – MAP Feb 3 '14 at 18:26

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.