[Qgis-user] Cannot add sqlite/spatialite layers to qgis (they come in as tables)

Alex Mandel tech_dev at wildintellect.com
Sun Dec 9 11:00:27 PST 2012


On 12/09/2012 10:40 AM, Donovan Cameron wrote:
> I created a sqlite/spatialite db from the spatialite_gui and started to
> import a bunch of shapefiles.
> 
> Some of the things I set were the CRS to EPSG:3005 "BC Albers" and the_geom
> as the name for the geometry field (type is set to auto...)
> 
> Then in spatialite_gui I expanded each new table and built a spatial index.
> I can also right click each the_geom table and see a valid "Map Preview".
> 
> But I can't open or load this .sqlite files into either spatialite_gis or
> qgis.
> So I think this could be a problem with my actual OS (openSUSE 12.2 x64 w/
> KDE).
> 
> QGIS loads the layers as tables, not vectors.
> spatialite_gis thrown an error:
> 
> Missing or invalid Spatial Metadata tables:
> - spatial_ref_sys
> - geometry_columns
> 
> Sorry, cowardly quitting ...
> 
> But those tables are in the .sqlite db under the "Metadata" portion.
> 
> From the layer menu in QGIS, I can't create a layer in a sqlite db. It says
> that my layer is invalid and can't be created. Then I can't even see this
> sqlite database (that got created successfully, it's just the layer that
> failed creation) when navigating from the add vector window. But I can see
> it when trying to load from spatialite_gis but that throws the same error.
> 
> I noticed in the DB Manager plugin, it says that pyspatialite is missing
> and that package isn't available for openSUSE in the open build service,
> unless it goes by a different name...
> 

to solve the missing pyspatialite:
easy_install pyspatialite
OR
pip install pyspatialite

packages for above commands
python-setuptools
python-pip or python-distrubute

Keep in mind that many python packages do not come in the distros but
are platform independent and easy to install from the pypi python repo
using setup tools or pip.

This doesn't solve your original issue. What version of spatialite are
you using. QGIS doesn't support the new 4.0 stuff yet...

Thanks,
Alex



More information about the Qgis-user mailing list