Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGIS Server - WFS GetFeature with multiple layers don't seems to works #24415

Closed
qgib opened this issue May 3, 2017 · 11 comments
Closed

QGIS Server - WFS GetFeature with multiple layers don't seems to works #24415

qgib opened this issue May 3, 2017 · 11 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server

Comments

@qgib
Copy link
Contributor

qgib commented May 3, 2017

Author Name: Benjamin Gerber (Benjamin Gerber)
Original Redmine Issue: 16509
Affected QGIS version: 2.18.0
Redmine category:qgis_server


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&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=pfa1,pfa1&amp;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


@qgib
Copy link
Contributor Author

qgib commented May 3, 2017

Author Name: Giovanni Manghi (@gioman)


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?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented May 3, 2017

Author Name: Benjamin Gerber (Benjamin Gerber)


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 ... 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)

@qgib
Copy link
Contributor Author

qgib commented May 8, 2017

Author Name: Giovanni Manghi (@gioman)


(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!

@qgib
Copy link
Contributor Author

qgib commented May 10, 2017

Author Name: Benjamin Gerber (Benjamin Gerber)


  • "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.

@qgib
Copy link
Contributor Author

qgib commented May 10, 2017

Author Name: Yves Jacolin (@yjacolin)


Steps to see the problem:

git clone git@github.com: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.


  • 10948 was configured as getFeature2.xml

@qgib
Copy link
Contributor Author

qgib commented May 26, 2017

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Feedback to Open

@qgib
Copy link
Contributor Author

qgib commented Jul 19, 2017

Author Name: Christophe Mangeat (Christophe Mangeat)


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 ?)


  • 11192 was configured as layers.tar.gz
  • 11193 was configured as payload.xml

@qgib
Copy link
Contributor Author

qgib commented Jul 20, 2017

Author Name: Christophe Mangeat (Christophe Mangeat)


Hello, associated PR: #4893

@qgib
Copy link
Contributor Author

qgib commented Jul 20, 2017

Author Name: Jürgen Fischer (@jef-n)


  • description was changed from 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):

the_geom 2715684.9999999995 1111404.444444444 2716404.9999999995 1112474.444444444 the_geom 2715684.9999999995 1111404.444444444 2716404.9999999995 1112474.444444444

The answer:

<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&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=pfa1,pfa1&amp;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

2716072.066,1111642.902

</qgs:geometry>
qgs:t_id254298</qgs:t_id>
qgs:identanCH020000TE</qgs:identan>
qgs:numero508a</qgs:numero>
qgs:geomalt528.201</qgs:geomalt>
qgs:attendplanno</qgs:attendplan>
qgs:attendplan_txtno</qgs:attendplan_txt>
qgs:precalt0.3</qgs:precalt>
qgs:attendaltsi</qgs:attendalt>
qgs:attendalt_txtsi</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

2716105.326,1111650.397

</qgs:geometry>
qgs:t_id254299</qgs:t_id>
qgs:identanCH020000TE</qgs:identan>
qgs:numero507a</qgs:numero>
qgs:geomalt528.117</qgs:geomalt>
qgs:attendplanno</qgs:attendplan>
qgs:attendplan_txtno</qgs:attendplan_txt>
qgs:precalt0.3</qgs:precalt>
qgs:attendaltsi</qgs:attendalt>
qgs:attendalt_txtsi</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

2716072.066,1111642.902

</qgs:geometry>
qgs:t_id254298</qgs:t_id>
qgs:identanCH020000TE</qgs:identan>
qgs:numero508a</qgs:numero>
qgs:geomalt528.201</qgs:geomalt>
qgs:attendplanno</qgs:attendplan>
qgs:attendplan_txtno</qgs:attendplan_txt>
qgs:precalt0.3</qgs:precalt>
qgs:attendaltsi</qgs:attendalt>
qgs:attendalt_txtsi</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

2716105.326,1111650.397

</qgs:geometry>
qgs:t_id254299</qgs:t_id>
qgs:identanCH020000TE</qgs:identan>
qgs:numero507a</qgs:numero>
qgs:geomalt528.117</qgs:geomalt>
qgs:attendplanno</qgs:attendplan>
qgs:attendplan_txtno</qgs:attendplan_txt>
qgs:precalt0.3</qgs:precalt>
qgs:attendaltsi</qgs:attendalt>
qgs:attendalt_txtsi</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
to 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):

  
    
      
        the_geom
        
          2715684.9999999995 1111404.444444444
          2716404.9999999995 1112474.444444444
        
      
    
  
  
    
      
        the_geom
        
          2715684.9999999995 1111404.444444444
          2716404.9999999995 1112474.444444444
        
      
    
  

The answer:

   
      
         2700519.74999999,1076245.12499999 2724130.50000001,1158202.12500001
      
   
   
      
         
            
               2716072.066,1111642.902 2716072.066,1111642.902
            
         
         
            
               2716072.066,1111642.902
            
         
         254298
         CH020000TE
         508a
         528.201
         no
         no
         0.3
         si
         si
      
   
   
      
         
            
               2716105.326,1111650.397 2716105.326,1111650.397
            
         
         
            
               2716105.326,1111650.397
            
         
         254299
         CH020000TE
         507a
         528.117
         no
         no
         0.3
         si
         si
      
   
   
      
         
            
               2716072.066,1111642.902 2716072.066,1111642.902
            
         
         
            
               2716072.066,1111642.902
            
         
         254298
         CH020000TE
         508a
         528.201
         no
         no
         0.3
         si
         si
      
   
   
      
         
            
               2716105.326,1111650.397 2716105.326,1111650.397
            
         
         
            
               2716105.326,1111650.397
            
         
         254299
         CH020000TE
         507a
         528.117
         no
         no
         0.3
         si
         si
      
   

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

@qgib
Copy link
Contributor Author

qgib commented Jul 20, 2017

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Open to In Progress
  • pull_request_patch_supplied was changed from 0 to 1

@qgib
Copy link
Contributor Author

qgib commented Aug 7, 2017

Author Name: Anónimo (Anónimo)


Applied in changeset 5701b67.


  • done_ratio was changed from 0 to 100
  • status_id was changed from In Progress to Closed

@qgib qgib closed this as completed Aug 7, 2017
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server
Projects
None yet
Development

No branches or pull requests

1 participant