[Lizmap] Publish WFS services in QGIS with Lizmap
G. Wagner, Wagner-IT
info at wagner-it.de
Mon May 30 08:17:49 PDT 2022
Hi,
The QGIS project contains only 2 layers:
* https://maps.zh.ch/wfs/TBAGeschZHWFS
* http://ows.terrestris.de/osm/service?VERSION=1.1.1 <http://ows.terrestris.de/osm/service?VERSION=1.1.1&> &
https://wms101.webgis.biz
This is the complete QGIS logfile (Log_Level 2) after reloading the project and zooming a few times:
16:46:34 WARNING [175770]: Error Service EXPRESSION 1.0.0 is already registered
16:46:34 WARNING [175770]: Error Service LIZMAP 1.0.0 is already registered
16:46:34 WARNING [175770]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
16:46:34 WARNING WFS[175770]: Cannot create temporary SpatiaLite cache.: Cannot copy file to /home/qgis/.local/share/QGIS/QGIS3/profiles/default/cache/wfsprovider/pid_175770/cache_1.sqlite:
16:47:16 WARNING [175770]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
16:47:18 WARNING [175770]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
16:47:18 WARNING [175770]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
16:47:22 WARNING [175770]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
16:47:26 WARNING [175770]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
The Apache2/error.log:
[Mon May 30 17:00:47.894406 2022] [mpm_prefork:notice] [pid 768] AH00163: Apache/2.4.41 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations
[Mon May 30 17:00:47.894416 2022] [core:notice] [pid 768] AH00094: Command line: '/usr/sbin/apache2'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-www-data'
Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable.
"Loading native module /usr/lib/qgis/server/libdummy.so"
"Loading native module /usr/lib/qgis/server/liblandingpage.so"
"Loading native module /usr/lib/qgis/server/libwcs.so"
"Loading native module /usr/lib/qgis/server/libwfs.so"
"Loading native module /usr/lib/qgis/server/libwfs3.so"
"Loading native module /usr/lib/qgis/server/libwms.so"
"Loading native module /usr/lib/qgis/server/libwmts.so"
proj_create: Error -38: failed to load datum shift file
proj_create: Error -38: failed to load datum shift file
proj_create: Error -38: failed to load datum shift file
QNetworkDiskCache::prepare() unable to open temporary file
QNetworkDiskCache::prepare() unable to open temporary file
QNetworkDiskCache::prepare() unable to open temporary file
QNetworkDiskCache::prepare() unable to open temporary file
The Apache2/access.log:
89.244.189.20 - - [30/May/2022:17:04:33 +0200] "GET /index.php/view/map/?repository=99&project=test_wfs HTTP/1.1" 200 10167 "https://wms101.webgis.biz/index.php/view/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:33 +0200] "GET /assets/favicon/android-icon-192x192.png HTTP/1.1" 200 35596 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:33 +0200] "GET /index.php/lizmap/service/getProjectConfig?repository=99&project=test_wfs HTTP/1.1" 200 3665 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:33 +0200] "GET /index.php/lizmap/service/?repository=99&project=test_wfs&SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0 HTTP/1.1" 200 2978 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:33 +0200] "GET /index.php/lizmap/service/?repository=99&project=test_wfs&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0 HTTP/1.1" 200 2778 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:33 +0200] "GET /index.php/lizmap/service/?repository=99&project=test_wfs&SERVICE=WFS&REQUEST=GetCapabilities&VERSION=1.0.0 HTTP/1.1" 200 1979 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:36 +0200] "GET /index.php/lizmap/service/?repository=99&project=test_wfs&LAYERS=geschwindigkeit&STYLES=default&VERSION=1.3.0&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&DPI=96&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetMap&CRS=EPSG%3A25832&BBOX=404609.6561575848,5218037.103935158,538753.6744456216,5284315.361491675&WIDTH=2028&HEIGHT=1002 HTTP/1.1" 200 8365 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
89.244.189.20 - - [30/May/2022:17:04:40 +0200] "GET /index.php/lizmap/service/?repository=99&project=test_wfs&LAYERS=geschwindigkeit&STYLES=default&VERSION=1.3.0&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&DPI=96&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetMap&CRS=EPSG%3A25832&BBOX=334358.9300590856,5186154.768657367,602646.9666351589,5318711.283770396&WIDTH=2028&HEIGHT=1002 HTTP/1.1" 200 102128 "https://wms101.webgis.biz/index.php/view/map/?repository=99&project=test_wfs" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
I hope this helps
Regards,
Günter
Von: Lizmap <lizmap-bounces at lists.osgeo.org> Im Auftrag von René-Luc Dhont
Gesendet: Montag, 30. Mai 2022 10:28
An: lizmap at lists.osgeo.org
Betreff: Re: [Lizmap] Publish WFS services in QGIS with Lizmap
Hi,
Here is the QGIS code
```c
// Creating a SpatiaLite database can be quite slow on some file systems
// so we create a GDAL in-memory file, and then copy it on
// the file system.
GDALDriverH hDrv = GDALGetDriverByName( "SQLite" );
if ( !hDrv )
{
logMessageWithReason( QStringLiteral( "GDAL SQLite driver not available" ) );
return false;
}
const QString vsimemFilename = QStringLiteral( "/vsimem/qgis_cache_template_%1/features.sqlite" ).arg( reinterpret_cast< quintptr >( this ), QT_POINTER_SIZE * 2, 16, QLatin1Char( '0' ) );
mCacheTablename = CPLGetBasename( vsimemFilename.toStdString().c_str() );
VSIUnlink( vsimemFilename.toStdString().c_str() );
const char *apszOptions[] = { "INIT_WITH_EPSG=NO", "SPATIALITE=YES", nullptr };
GDALDatasetH hDS = GDALCreate( hDrv, vsimemFilename.toUtf8().constData(), 0, 0, 0, GDT_Unknown, const_cast<char **>( apszOptions ) );
if ( !hDS )
{
logMessageWithReason( QStringLiteral( "GDALCreate() failed: %1" ).arg( CPLGetLastErrorMsg() ) );
return false;
}
GDALClose( hDS );
// Copy the temporary database back to disk
vsi_l_offset nLength = 0;
GByte *pabyData = VSIGetMemFileBuffer( vsimemFilename.toStdString().c_str(), &nLength, TRUE );
Q_ASSERT( !QFile::exists( mCacheDbname ) );
VSILFILE *fp = VSIFOpenL( mCacheDbname.toStdString().c_str(), "wb" );
if ( fp )
{
VSIFWriteL( pabyData, 1, nLength, fp );
VSIFCloseL( fp );
CPLFree( pabyData );
}
else
{
CPLFree( pabyData );
logMessageWithReason( QStringLiteral( "Cannot copy file to %1: %2" ).arg( mCacheDbname ).arg( CPLGetLastErrorMsg() ) );
return false;
}
```
So the database to store WFS Features has been created in memory with GDAL/OGR and the path "/vsimem/qgis_cache_template_%1/features.sqlite" and will be write to disk in QGIS cache directory.
The mCacheDbname is defined like that:
```c
Q_ASSERT( mCacheDbname.isEmpty() );
static QAtomicInt sTmpCounter = 0;
int tmpCounter = ++sTmpCounter;
QString cacheDirectory( acquireCacheDirectory() );
mCacheDbname = QDir( cacheDirectory ).filePath( QStringLiteral( "cache_%1.sqlite" ).arg( tmpCounter ) );
Q_ASSERT( !QFile::exists( mCacheDbname ) );
```
In the log provided by Günter, we don't have enough reason. The CPLGetLastErrorMsg is empty.
Günter, can you provide more logs arround the message "Cannot create temporary SpatiaLite cache.: Cannot copy file to" ?
Regards,
René-Luc DHONT
Le 30/05/2022 à 08:57, FANGAIN Marjorie a écrit :
Hi,
I’ve got also some problems with WFS layers for several months.
I’ve created a ticket on github :
https://github.com/3liz/lizmap-web-client/issues/2792
Marjorie FANGAIN
De : Lizmap <mailto:lizmap-bounces at lists.osgeo.org> <lizmap-bounces at lists.osgeo.org> De la part de Peter Berger
Envoyé : vendredi 27 mai 2022 11:26
À : G. Wagner, Wagner-IT <mailto:info at wagner-it.de> <info at wagner-it.de>; lizmap at lists.osgeo.org <mailto:lizmap at lists.osgeo.org>
Objet : Re: [Lizmap] Publish WFS services in QGIS with Lizmap
EXTERNAL EMAIL
Original Sender: SRS0=UtB1=WD=lists.osgeo.org=lizmap-bounces at osgeo.org <mailto:SRS0=UtB1=WD=lists.osgeo.org=lizmap-bounces at osgeo.org>
I made the same observation. On Windows 10 all WFS layers are well displayed in Lizmap but not on a osgeolive linux installation with the same QGIS file.
Peter
Von meinem iPhone gesendet
Am 27.05.2022 um 07:34 schrieb G. Wagner, Wagner-IT <info at wagner-it.de <mailto:info at wagner-it.de> >:
Hi everyone,
I am trying to publish a WFS service integrated in QGIS with QGIS Server/Lizmap (QGIS-Server 3.22.7, Lizmap 3.5.3).
The corresponding layer name is displayed in the Lizmap client but no data is displayed. Or sometimes and only once in a zoom level.
The error message in the QGIS error log could fit to this (cache problem?):
WARNING WFS[1497]: Cannot create temporary SpatiaLite cache.: Cannot copy file to /home/qgis/.local/share/QGIS/QGIS3/profiles/default/cache/wfsprovider/pid_1497/cache_1.sqlite:
Creating the directories "/home/qgis/.local/share/QGIS/QGIS3/profiles/default/cache/wfsprovider" with appropriate permissions does not change anything.
In the Apache error.log there is still the message:
QNetworkDiskCache::prepare() unable to open temporary file
In the Apache.conf is defined:
FcgidInitialEnv QGIS_SERVER_CACHE_DIRECTORY "/home/qgis/cache"
What am I doing wrong?
Greeting
Günter
_______________________________________________
Lizmap mailing list
Lizmap at lists.osgeo.org <mailto:Lizmap at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/lizmap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/lizmap/attachments/20220530/362729e7/attachment-0001.htm>
More information about the Lizmap
mailing list