5

Spatialite is a great alternative to shapefiles - but how could I store the QGIS layer style together with the data so that it has a default style?

For a shapefile I would just save a [name].qml with the [name].shp file set, and it would style by default. Any equivalent for Spatialite?

5
  • Would you consider revising the scope of your question to include storage of not just .qml, but also the entire .qgs file? I've been thinking of an entire QGIS project -- data, style, and settings -- in a single, cross-platform file. Yes, please.
    – Scro
    Aug 22 '13 at 16:32
  • Currently the .qps file contains styles and settings, but not data. I can't imagine you would want all data stored in each project file. That would potentially make each qps huge (think aerial imagery), and duplicate copies of data over and over.
    – Micha
    Aug 22 '13 at 18:18
  • Regarding the original question, work is being done[1] to save layer styles to a PostGIS database. I'd like to hope that spatialite will follow soon after. [1]github.com/qgis/Quantum-GIS/pull/522
    – Micha
    Aug 22 '13 at 18:21
  • @Micha Note that I'm not proposing that storing a project in sqLite would preclude QGIS from connecting to other data sources. I use a lot of project-specific data that would do well to be contained in one file. DropBox anyone?
    – Scro
    Aug 22 '13 at 19:29
  • @Scro, no, I wanted to just limit the question to the specifics of the layer style, but getting the .qgs file in there is an attractive idea!
    – Simbamangu
    Aug 23 '13 at 7:35
6

This feature was added to the master branch of QGIS about 4 months ago, but only for PostgreSQL/PostGIS databases, not Spatialite. The series of commits could be squashed down to provide a concise view of how to add such support for Spatialite. Please submit a feature request, and link to this page.

Interesting side note, Spatialite 4.1+ offers a new storage blob, XmlBlob. There has been talk of making Spatialite the default vector format (not shapefile) for QGIS. And, there is talk/plans for allowing many aspects of a project to be stored in a database, including the .qgs file, metadata and styles (I believe @nathan-w may be working on this). This is the reason the File menu was recently renamed to Project, since a database connection could be the sole source of a project.

The new XmlBlob offers a nice solution for these geo resources, and I for one, would like to see a simple solution for storing whole projects, with data, metadata, styles and symbols in a single, multi-platform db file (i.e. Spatialite):

1
  • Shame there's no option yet - but very encouraging news on the potential in 4.1 and adding this as default for QGIS.
    – Simbamangu
    Aug 23 '13 at 7:37
6

now it'a available in Master and will be officially available in Qgis 2.4

http://pvanb.wordpress.com/2014/05/15/saving-layer-styles-to-your-spatialite-database/

1
  • and in master will be available also delete... PR under revision Jan 31 '17 at 11:21

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .