Bug report #15062

Cannot create temporary SpatiaLite cache while adding WFS layer

Added by dr - over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:Even Rouault
Category:Web Services clients/WFS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:23005

Description

I'm trying to add WFS layer (using WFS VERSION 1.0), and get an message on WFS tab:

Cannot create temporary SpatiaLite cache

If open attribute table - all attributes are ERROR, if open attribute table again - it will be completely empty (no records).

Associated revisions

Revision d7414d7e
Added by Even Rouault over 8 years ago

[WFS provider] Handle the case where the layer schema has a ogc_fid field

Fixes #15062

History

#1 Updated by Even Rouault over 8 years ago

Could you check that your cache directory is correctly pointing to an existing directory that is writable ? (in Settings / Option / Network / Cache Settings : Directory )

#2 Updated by dr - over 8 years ago

I've pointed cache directory to "~/.qgis2/cache", after trying to add WFS layer I see newly created foler "~/.qgis2/cache/wfsprovider/pid_18340" with "wfs_cache_1.sqlite" file.

#3 Updated by Even Rouault over 8 years ago

What was pointing it too before ? (if empty, on an installed QGIS, it should also point to ~/.qgis2/cache. In a dev environement, it would point to $(buildpath)/)

#4 Updated by dr - over 8 years ago

Before it was empty (#14514). But if I set up cache directory as described above WFS doesn't work and I see error mesage on WFS tab again.

#5 Updated by Even Rouault over 8 years ago

I'm confused. If you set to "~/.qgis2/cache", doesn't it work (it seems to, since you can see the "~/.qgis2/cache/wfsprovider" folder)

#6 Updated by dr - over 8 years ago

Have updated QGIS to latest master.

WFS server contains several layers. All works fine when I add first layer. But when I add second layer - got "Cannot create temporary SpatiaLite cache". Part of stacktrace:

ERROR 1: Unable to Initialize SpatiaLite Metadata: no such function: InitSpatialMetadata
src/providers/wfs/qgswfsshareddata.cpp: 322: (createCache) [0ms] [thread:0x7f7e3c00a780] spatialite provider loaded
src/providers/spatialite/qgsspatialiteprovider.cpp: 5147: (createDb) [0ms] [thread:0x7f7e3c00a780] creating a new db
src/providers/spatialite/qgsspatialiteprovider.cpp: 5151: (createDb) [0ms] [thread:0x7f7e3c00a780] making this dir: /tmp
src/providers/wfs/qgswfsfeatureiterator.cpp: 1148: (close) [177ms] [thread:0x7f7e3c00a2a0] qgsWFSFeatureIterator::close()
src/providers/wfs/qgswfsfeatureiterator.cpp: 835: (~QgsWFSFeatureIterator) [0ms] [thread:0x7f7e3c00a2a0] qgsWFSFeatureIterator::~QgsWFSFeatureIterator()
src/core/qgsmaprendererparalleljob.cpp: 262: (renderLayerStatic) [0ms] [thread:0x7f7e3c00a2a0] job 55bdf9b0d4a0 end [180 ms] (layer water20160622224402005)
AddGeometryColumn() error: table 'features' does not exist
CreateSpatialIndex() error: either "features"."GEOMETRY" isn't a Geometry column or a SpatialIndex is already defined
src/core/qgsmessagelog.cpp: 45: (logMessage) [61ms] [thread:0x7f7e3c00a780] 2016-06-22T22:44:11 WFS[1] Cannot create temporary SpatiaLite cache
src/providers/wfs/qgswfsfeatureiterator.cpp: 1148: (close) [1ms] [thread:0x7f7e3c00a780] qgsWFSFeatureIterator::close()
src/providers/wfs/qgswfsfeatureiterator.cpp: 835: (~QgsWFSFeatureIterator) [0ms] [thread:0x7f7e3c00a780] qgsWFSFeatureIterator::~QgsWFSFeatureIterator()

#7 Updated by Even Rouault over 8 years ago

I cannot reproduce what you observe (works fine when adding several layers) and don't have a theory.

- Which GDAL version is used ?
- The "creating a new db" is displayed at the first layer or the second one (should be only at the first one) ?

#8 Updated by Giovanni Manghi over 8 years ago

  • Category set to Web Services clients/WFS
  • Status changed from Open to Feedback

any URL I can test here locally?

#9 Updated by dr - over 8 years ago

I've made public demo: http://188.166.42.99/cgi-bin/mapserv?map=/var/www/wfs.map&

#10 Updated by Even Rouault over 8 years ago

  • Assignee set to Even Rouault

Reproduced. Due to a ogc_fid field name that conflicts with the FID column name of the spatialite cache. Fix under way

#11 Updated by Even Rouault over 8 years ago

  • Status changed from Feedback to Closed

#12 Updated by Even Rouault over 8 years ago

  • Resolution set to fixed/implemented
  • Target version set to Version 2.16
  • % Done changed from 0 to 100

Also available in: Atom PDF