[Qgis-user] SQLite plugin

Frazier, Tyler James tyler.j.frazier at tu-berlin.de
Thu Oct 25 11:08:34 PDT 2012


When I try to load a QGIS layer into the SQLite Database I get the following two errors

The SQL query seems to be invalid.  no such table: geometry_columns

This DataBase seems to be a valid SQLite DataBase but not a valid SpatiaLite One
Would you like QSpatiaLite to automatically transform it to SpatiaLite (information won't be lost) ?

If I say no to the transform, the import seems to work, but the tables don't appear in the plugin, just in the database manager (where I can see the records are correct).  If I say yes to the transform the tables appear, but they are empty.

Any ideas?  Maybe I should follow Nilo's suggestion regarding pyspatialite and the instructions at http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-cookbook/html/python.html  ???

On Oct 25, 2012, at 7:45 PM, Frazier, Tyler James wrote:

I reinstalled GDAL complete, GSL and QGIS and reinstalled the plugins but it seems I'm getting the same error.  still not sure what to do?

An error has occured while executing Python code:

Traceback (most recent call last):
  File "/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/importQgis/importQgis.py", line 64, in run
    if not self.parent.db.uploadQgisVectorLayer(layer, tableName=self.tablenames[i], srid=self.srid, selected=self.selected):
  File "/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/Classes/Database.py", line 249, in uploadQgisVectorLayer
    header,data=self.executeQuery("""INSERT INTO "%s" VALUES (%s,%s)"""%(tableName,','.join([unicode(value).encode('utf-8') for value in values_auto]),','.join('?'*len(values_perso))),tuple([unicode(value) for value in values_perso]),commit=True)
  File "/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/Classes/Database.py", line 45, in executeQuery
    cursor.execute(query,params)
IntegrityError: towns_r1.Geometry violates Geometry constraint [geom-type or SRID not allowed]

Python version:
2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]


QGIS version:
1.8.0-Lisboa Lisboa,

Python path: ['/Applications/QGIS.app/Contents/MacOS/../Resources/python', '/Users/tyfrazier/.qgis//python', '/Users/tyfrazier/.qgis//python/plugins', '/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins', '/Library/Frameworks/SQLite3.framework/Versions/3/Python/2.7', '/Library/Python/2.7/site-packages/numpy-override', '/Library/Frameworks/GDAL.framework/Versions/1.9/Python/2.7/site-packages', '/Library/Frameworks/cairo.framework/Versions/1/Python/2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/PIL', '/Applications/QGIS.app/Contents/Resources/python/plugins/fTools/tools', '/Users/tyfrazier/Documents/workspace/frazier/simpop_accra/mapping/qgis_project']


On Oct 25, 2012, at 6:13 PM, William Kyngesburye wrote:

Just GDAL Complete needs to be updated.

On Oct 25, 2012, at 11:06 AM, Frazier, Tyler James wrote:

Hi William, I notice the pyspatialite link Noli provided points the source back to your website for Mac OSX users.  If I did a complete uninstall/reinstall of QGIS and the GDAL framework shouldn't that fix the problem with pyspatialite?  Thanks, Ty


On Oct 25, 2012, at 4:26 PM, William Kyngesburye wrote:

Looks like a different error now, and one that might really be related to something wrong with pyspatialite.

If you installed QGIS/GDAL a while ago, you should update.  I did have a problem in the SQLite framework at one point where it wouldn't load the spatialite stuff.  Fixed in the latest frameworks.

On Oct 25, 2012, at 9:09 AM, Frazier, Tyler James wrote:

When I try to load QGIS layers to SQLite using the plugin I get the following error ... I assumed SQLite was installed as part of the GDAL bundle, but I did that some time ago.

An error has occured while executing Python code:

Traceback (most recent call last):
File "/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/importQgis/importQgis.py", line 64, in run
  if not self.parent.db.uploadQgisVectorLayer(layer, tableName=self.tablenames[i], srid=self.srid, selected=self.selected):
File "/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/Classes/Database.py", line 249, in uploadQgisVectorLayer
  header,data=self.executeQuery("""INSERT INTO "%s" VALUES (%s,%s)"""%(tableName,','.join([unicode(value).encode('utf-8') for value in values_auto]),','.join('?'*len(values_perso))),tuple([unicode(value) for value in values_perso]),commit=True)
File "/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/Classes/Database.py", line 45, in executeQuery
  cursor.execute(query,params)
IntegrityError: ea_r1.Geometry violates Geometry constraint [geom-type or SRID not allowed]

Python version:
2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]


QGIS version:
1.8.0-Lisboa Lisboa,

Python path: ['/Applications/QGIS.app/Contents/MacOS/../Resources/python', '/Users/tyfrazier/.qgis//python', '/Users/tyfrazier/.qgis//python/plugins', '/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins', '/Library/Frameworks/SQLite3.framework/Versions/3/Python/2.7', '/Library/Python/2.7/site-packages/numpy-override', '/Library/Frameworks/GDAL.framework/Versions/1.9/Python/2.7/site-packages', '/Library/Frameworks/cairo.framework/Versions/1/Python/2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/PIL', '/Applications/QGIS.app/Contents/Resources/python/plugins/fTools/tools', '/Users/tyfrazier/Documents/workspace/frazier/simpop_accra/mapping/qgis_project']


On Oct 25, 2012, at 3:31 PM, William Kyngesburye wrote:

It looks like Tyler is on OS X.  My SQLite framework includes pyspatialite.  If it was missing, wouldn't there be an python import error instead?

On Oct 25, 2012, at 6:50 AM, Noli Sicad wrote:

Hi Tyler,

You need to install pyspatialite.

Find out first the version of your spatialtite and follow the
instruction on how to install pyspatilate here.

http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-cookbook/html/python.html

Noli

On 10/25/12, Frazier, Tyler James <tyler.j.frazier at tu-berlin.de<mailto:tyler.j.frazier at tu-berlin.de>> wrote:
Hi, I was trying to load a QGIS layer into SQLite using the SQLite plugin
and get the following error -- not sure what to do?  Any suggestions?
thanks! Ty

An error has occured while executing Python code:

Traceback (most recent call last):
File
"/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/QspatiaLiteApp.py", line
358, in importTxt
self.app=ImportTxt(self)
File
"/Users/tyfrazier/.qgis//python/plugins/QspatiaLite/importTxt/importTxt.py",
line 30, in __init__
self.ui.charsetList_CSV.insertItems(0, self.charset)
TypeError: QComboBox.insertItems(int, QStringList): argument 2 has
unexpected type 'list'

Python version:
2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]


QGIS version:
1.8.0-Lisboa Lisboa,

Python path: ['/Applications/QGIS.app/Contents/MacOS/../Resources/python',
'/Users/tyfrazier/.qgis//python', '/Users/tyfrazier/.qgis//python/plugins',
'/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins',
'/Library/Frameworks/SQLite3.framework/Versions/3/Python/2.7',
'/Library/Python/2.7/site-packages/numpy-override',
'/Library/Frameworks/GDAL.framework/Versions/1.9/Python/2.7/site-packages',
'/Library/Frameworks/cairo.framework/Versions/1/Python/2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
'/Library/Python/2.7/site-packages',
'/Library/Python/2.7/site-packages/PIL',
'/Applications/QGIS.app/Contents/Resources/python/plugins/fTools/tools',
'/Users/tyfrazier/Documents/workspace/frazier/simpop_accra/mapping/qgis_project']

-----
Tyler Frazier
Department of Transportation Planning and Telematics
Technical University Berlin
http://www.vsp.tu-berlin.de/




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20121025/6c1fb185/attachment.html>


More information about the Qgis-user mailing list