Bug report #16509
QGIS Server - WFS GetFeature with multiple layers don't seems to works
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | QGIS Server | ||
Affected QGIS version: | 2.18.0 | Regression?: | No |
Operating System: | Ubuntu 16.10 (via docker) | Easy fix?: | No |
Pull Request or Patch supplied: | Yes | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 24415 |
Description
Hi there !
(QGIS Server v2.18)
In a project with have multiple points layers (named here pfa and pfa2).
(These layers are in a group "Punti fissi" that is in a group "MU Cadastre")
Both layers support WMS and WMF queries (Set in the layer property)
Both layers are published in the WFS capacity of the Project property.
Now, If I do a request with pfa1 as first Query and pfa2 as second Query (but in the same request), I got twice the result for pfa1 and any informations for pfa2. If I invert pfa 1 and pfa2, the result is inverted. If I add a pfa3, I got third time the result for the first queried result. If I query only one layer, that works fine.
The payload of the request (POST request):
<GetFeature xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.1.0" outputFormat="GML3" maxFeatures="20" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <Query xmlns:feature="http://www.qgis.org/gml" typeName="feature:pfa1" srsName="EPSG:2056"> <Filter xmlns="http://www.opengis.net/ogc"> <BBOX> <PropertyName>the_geom</PropertyName> <Envelope xmlns="http://www.opengis.net/gml" srsName="EPSG:2056"> <lowerCorner>2715684.9999999995 1111404.444444444</lowerCorner> <upperCorner>2716404.9999999995 1112474.444444444</upperCorner> </Envelope> </BBOX> </Filter> </Query> <Query xmlns:feature="http://www.qgis.org/gml" typeName="feature:pfa2" srsName="EPSG:2056"> <Filter xmlns="http://www.opengis.net/ogc"> <BBOX> <PropertyName>the_geom</PropertyName> <Envelope xmlns="http://www.opengis.net/gml" srsName="EPSG:2056"> <lowerCorner>2715684.9999999995 1111404.444444444</lowerCorner> <upperCorner>2716404.9999999995 1112474.444444444</upperCorner> </Envelope> </BBOX> </Filter> </Query> </GetFeature>
The answer:
<?xml version="1.0" encoding="UTF-8"?> <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:qgs="http://www.qgis.org/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.qgis.org/gml http://localhost:8580/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=pfa1,pfa1&OUTPUTFORMAT=XMLSCHEMA"> <gml:boundedBy> <gml:Box srsName="EPSG:2056"> <gml:coordinates cs="," ts=" ">2700519.74999999,1076245.12499999 2724130.50000001,1158202.12500001</gml:coordinates> </gml:Box> </gml:boundedBy> <gml:featureMember> <qgs:pfa1 fid="pfa1.1"> <gml:boundedBy> <gml:Box srsName="EPSG:2056"> <gml:coordinates cs="," ts=" ">2716072.066,1111642.902 2716072.066,1111642.902</gml:coordinates> </gml:Box> </gml:boundedBy> <qgs:geometry> <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:2056"> <coordinates>2716072.066,1111642.902</coordinates> </Point> </qgs:geometry> <qgs:t_id>254298</qgs:t_id> <qgs:identan>CH020000TE</qgs:identan> <qgs:numero>508a</qgs:numero> <qgs:geomalt>528.201</qgs:geomalt> <qgs:attendplan>no</qgs:attendplan> <qgs:attendplan_txt>no</qgs:attendplan_txt> <qgs:precalt>0.3</qgs:precalt> <qgs:attendalt>si</qgs:attendalt> <qgs:attendalt_txt>si</qgs:attendalt_txt> </qgs:pfa1> </gml:featureMember> <gml:featureMember> <qgs:pfa1 fid="pfa1.2"> <gml:boundedBy> <gml:Box srsName="EPSG:2056"> <gml:coordinates cs="," ts=" ">2716105.326,1111650.397 2716105.326,1111650.397</gml:coordinates> </gml:Box> </gml:boundedBy> <qgs:geometry> <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:2056"> <coordinates>2716105.326,1111650.397</coordinates> </Point> </qgs:geometry> <qgs:t_id>254299</qgs:t_id> <qgs:identan>CH020000TE</qgs:identan> <qgs:numero>507a</qgs:numero> <qgs:geomalt>528.117</qgs:geomalt> <qgs:attendplan>no</qgs:attendplan> <qgs:attendplan_txt>no</qgs:attendplan_txt> <qgs:precalt>0.3</qgs:precalt> <qgs:attendalt>si</qgs:attendalt> <qgs:attendalt_txt>si</qgs:attendalt_txt> </qgs:pfa1> </gml:featureMember> <gml:featureMember> <qgs:pfa1 fid="pfa1.1"> <gml:boundedBy> <gml:Box srsName="EPSG:2056"> <gml:coordinates cs="," ts=" ">2716072.066,1111642.902 2716072.066,1111642.902</gml:coordinates> </gml:Box> </gml:boundedBy> <qgs:geometry> <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:2056"> <coordinates>2716072.066,1111642.902</coordinates> </Point> </qgs:geometry> <qgs:t_id>254298</qgs:t_id> <qgs:identan>CH020000TE</qgs:identan> <qgs:numero>508a</qgs:numero> <qgs:geomalt>528.201</qgs:geomalt> <qgs:attendplan>no</qgs:attendplan> <qgs:attendplan_txt>no</qgs:attendplan_txt> <qgs:precalt>0.3</qgs:precalt> <qgs:attendalt>si</qgs:attendalt> <qgs:attendalt_txt>si</qgs:attendalt_txt> </qgs:pfa1> </gml:featureMember> <gml:featureMember> <qgs:pfa1 fid="pfa1.2"> <gml:boundedBy> <gml:Box srsName="EPSG:2056"> <gml:coordinates cs="," ts=" ">2716105.326,1111650.397 2716105.326,1111650.397</gml:coordinates> </gml:Box> </gml:boundedBy> <qgs:geometry> <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:2056"> <coordinates>2716105.326,1111650.397</coordinates> </Point> </qgs:geometry> <qgs:t_id>254299</qgs:t_id> <qgs:identan>CH020000TE</qgs:identan> <qgs:numero>507a</qgs:numero> <qgs:geomalt>528.117</qgs:geomalt> <qgs:attendplan>no</qgs:attendplan> <qgs:attendplan_txt>no</qgs:attendplan_txt> <qgs:precalt>0.3</qgs:precalt> <qgs:attendalt>si</qgs:attendalt> <qgs:attendalt_txt>si</qgs:attendalt_txt> </qgs:pfa1> </gml:featureMember> </wfs:FeatureCollection>
Expected result: 2 results for pfa1, 3 for pfa2.
The result: 4 results for pfa1, 0 for pfa2
Can you reproduce this issue ?
Thanks in advance
Associated revisions
Merge pull request #4893 from cmangeat/bug_16509
allow WFS GetFeature upon multiple layers, fixes #16509
History
#1 Updated by Giovanni Manghi over 7 years ago
- Status changed from Open to Feedback
Can you share the project+data? when you say "query" you mean defining a filter in the WFS layer before loading it in QGIS with the WFS client?
#2 Updated by Benjamin Gerber over 7 years ago
Can you share the project+data?
Sorry, it's private :-/
I can try to reproduce the bug with another data in a "standalone" qgis server but I was hoping that you have something already set up and can give me a feedback if you can reproduce this bug easily. (If you can't, I'll (try to) reproduce the issue with data that I can give you).
When you say "query" you mean defining a filter in the WFS layer before loading it in QGIS with the WFS client?
The "query" word is related to the xml payload. Both <Query>...</Query> are in the same payload of the same http post request. (I just do a "curl -X POST -d @payload.xml http://localhost:8580" with the payload that I've provided in my first commment). And the project has two layers configured for WFS.
(I hope that's clear)
#3 Updated by Giovanni Manghi over 7 years ago
(I hope that's clear)
sorry no. I don't uderstand when you say ""standalone" qgis server" (it means not in docker?) and still do not understand what do you mean with payload (do you mean a particular URL request?).
Can you provide a sample project with minimal data (even fake) and precise steps on how replicate?
thanks!
#4 Updated by Benjamin Gerber over 7 years ago
- "standalone" qgis server -> a computer with qgis-server and that's it (and apache, and curl). So out of a project complexity.
- request payload: POST xml data of a HTTP request.
I've tried to reproduce a working use case with a simple WFS request with free OSM data but I've failed for now (problem in my qgis server configuration.) I don't have time to continue yet but i'll update this ticket later, when I'll got news.
Thanks you GM.
#5 Updated by Yves Jacolin over 7 years ago
- File getFeature2.xml added
Steps to see the problem:
git clone [email protected]:camptocamp/ms_perfs.git cd ms_perfs ./prepare.sh ctrl+c after a while docker-compose up curl -X POST -d @getFeature2.xml http://localhost:8084/?
See getFeature2.xml file attached.
#6 Updated by Giovanni Manghi over 7 years ago
- Status changed from Feedback to Open
#7 Updated by Christophe Mangeat over 7 years ago
- File layers.tar.gz added
- File payload.xml added
Hello, seems that following patch fixes with "release-2_18":
--- a/src/server/qgswfsserver.cpp +++ b/src/server/qgswfsserver.cpp @@ -455,7 +455,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format } for ( int i = 0; i < queryNodes.size(); i++ ) { - queryElem = queryNodes.at( 0 ).toElement(); + queryElem = queryNodes.at( i ).toElement(); mTypeName = queryElem.attribute( "typeName", "" ); if ( mTypeName.contains( ":" ) ) {
Can also be reproduced with:
curl -H "Content-type: text/xml" -d @payload.xml ".../cgi-bin/qgis_mapserv.fcgi?map=.../layers.qgs" | grep "qgs" | grep "id".
Seems to be ok on master (services/qgswfsgetfeature.cpp around line 760 ?)
#8 Updated by Christophe Mangeat over 7 years ago
Hello, associated PR: https://github.com/qgis/QGIS/pull/4893
#9 Updated by Jürgen Fischer over 7 years ago
- Description updated (diff)
#10 Updated by Giovanni Manghi over 7 years ago
- Status changed from Open to In Progress
- Pull Request or Patch supplied changed from No to Yes
#11 Updated by Anonymous over 7 years ago
- % Done changed from 0 to 100
- Status changed from In Progress to Closed
Applied in changeset qgis|5701b67e5876582b05be502a56110a1ef5f69beb.