Gis Tricks

Spatialite virtualshape

Spatialite virtualshape

Recently we started to use spatialite as local storage. For a certain project we like to query spatialite in combination with a shapefile. For that luckily we have the VirtualShape extension.

dbmanager qgis

DBmanager in QGis

Usually I use dbmanager in QGis to connect to spatialite. So I first tried using the extension in this SQL editor.

 CREATE VIRTUAL TABLE test_shape USING VirtualShape(shape_towns, CP1252, 32632) 

Query succeeded, table was even created. But I only saw an empty table:
<a href=""><img class="size-medium wp-image-2429" src="" alt="Empty table" width="300" height="224" /></a> Empty table

What could be the problem? My first thought was that there was something wrong with the query or the encoding I used. So I fiddled around a bit with location of the shapefile, quotes and encoding. No result. More logical:  it could be QGis itself!

Next step was to install <a href="" target="_blank">commandline </a>(why didn't I have this already?? ). I installed:
Both in the same directory.

I placed the shapefile also in this install directory and made exactly the same query as shown before. Then I did a simple  SELECT * FROM test_shape LIMIT 1 

and behold! It worked. Of course in QGis you can’t see anything, which does make sense. It is only meant for querying, not for viewing.

Leave a Reply

Your email address will not be published. Required fields are marked *

one × 4 =