[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:16:09 PST 2012


The plugin requires pyspatialite but QGIS itself has the provider built in.

"SpatiaLite version ..: 4.0.0"

Grab an older version of the Spatialite GUI (1.4 or 1.5) or figure out
how to convert your db to the 3.x variant (I believe the release notes
mention this is possible). The metadata table changed between 3 and 4
and QGIS does not have the version 4 stuff yet (it only came out a few
weeks ago).

Thanks,
Alex

On 12/09/2012 11:11 AM, Donovan Cameron wrote:
> Thanks alex, that's definitely helpful.
> I tried to install pyspatialite with easy_install and it tries to grab
> "Best match: pyspatialite 3.0.1" which fails with a lot of errors...
> 
> I can run through the tutorials from the spatialite page and this is the
> initial output, telling me I am using spatialite 4:
> SpatiaLite version ..: 4.0.0    Supported Extensions:
>         - 'VirtualShape'        [direct Shapefile access]
>         - 'VirtualDbf'          [direct DBF access]
>         - 'VirtualXL'           [direct XLS access]
>         - 'VirtualText'         [direct CSV/TXT access]
>         - 'VirtualNetwork'      [Dijkstra shortest path]
>         - 'RTree'               [Spatial Index - R*Tree]
>         - 'MbrCache'            [Spatial Index - MBR cache]
>         - 'VirtualSpatialIndex' [R*Tree metahandler]
>         - 'VirtualFDO'          [FDO-OGR interoperability]
>         - 'SpatiaLite'          [Spatial SQL - OGC]
> PROJ.4 version ......: Rel. 4.8.0, 6 March 2012
> GEOS version ........: 3.3.6-CAPI-1.7.6
> SQLite version ......: 3.7.12.1
> 
> I only installed QGIS from the GEO openSUSE repo.
> I wonder if this is a dependency issue for the package maintainers?
> 
> I have a freshly installed 12.2 KDE on a laptop and that also shows the
> same output from above when creating a new sqlite db from spatialite.
> 
> 
> On Sun, Dec 9, 2012 at 12:00 PM, Alex Mandel <tech_dev at wildintellect.com>wrote:
> 
>> 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
>>
> 
> 
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
> 




More information about the Qgis-user mailing list