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

QGISserver WFS returns invalid GML in case of cascading WFS #41292

Closed
rduivenvoorde opened this issue Feb 1, 2021 · 2 comments · Fixed by #41335
Closed

QGISserver WFS returns invalid GML in case of cascading WFS #41292

rduivenvoorde opened this issue Feb 1, 2021 · 2 comments · Fixed by #41335
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server

Comments

@rduivenvoorde
Copy link
Contributor

As reported in the user mailing list:
https://lists.osgeo.org/pipermail/qgis-user/2021-February/047880.html

it looks like QGIS WFS server does not return valid GML in case of a cascading WFS.
I think it tries to add a 'namespace' to the featuremember xml elements, while there IS already a 'namespace'.

See below: the <qgs:test:provincies gml:id="test:provincies.3"> parts.

<gml:featureMember>
 <qgs:test:provincies gml:id="test:provincies.3">
  <gml:boundedBy>
   <gml:Envelope srsName="EPSG:28992">
    <gml:lowerCorner>72132.8 359038.7</gml:lowerCorner>
    <gml:upperCorner>200852 426854.1</gml:upperCorner>
   </gml:Envelope>
  </gml:boundedBy>
  <qgs:geometry>
   <MultiPolygon xmlns="http://www.opengis.net/gml" srsName="EPSG:28992">
    <polygonMember xmlns="http://www.opengis.net/gml">
     <Polygon xmlns="http://www.opengis.net/gml">
      <exterior xmlns="http://www.opengis.net/gml">
       <LinearRing xmlns="http://www.opengis.net/gml">
        <posList xmlns="http://www.opengis.net/gml" srsDimension="2">200191.5 399580.1 200258.9 399250.3 200144.6 398823.5 200090 398221 200188 397887.5 200345.8 397471.3 200590 397074.4 200852 396850.7 200731.2 396765.2 200604 396884.7 200499.7 396829.7 200563.4 396699.9 200317.9 396630.7 200086.5 396746.2 199758.4>
       </LinearRing>
      </exterior>
     </Polygon>
    </polygonMember>
   </MultiPolygon>
  </qgs:geometry>
  <qgs:fid>11</qgs:fid>
  <qgs:PROVC>30</qgs:PROVC>
  <qgs:PROVC_NM>Noord-Brabant</qgs:PROVC_NM>
  <qgs:INW_T>2373569</qgs:INW_T>
 </qgs:test:provincies>
</gml:featureMember>
<gml:featureMember>

Attached: test.gml.zip is the return data from QGISserver.

To reproduce:

  • create a simple Geoserver layer (I downloaded 2.18.2) and serv it as WFS, I put it in a namespace 'test' can the layer was named 'provincies)
  • create a QGIS project with only THAT wfs layer, make sure you add it to serve it in the layer props
  • use that project as a project file for QGISserver WFS (I just used qgis_mapsever in output directory)
  • create a QGIS project and connect to the running QGISserver
  • note that it rightfully shows the layers
  • note that it returns the layer as WM(!)S fine
  • note that it it returns an error whey you try to show it as WFS

By looking in the debug window of QGISserver, copy/pasting the url and saving the response as test.gml I was able to save the attached test.gml.zip

Also note the

```ogrinfo test.gml`` works and shows:

$ ogrinfo test.gml
INFO: Open of `test.gml'
      using driver `GML' successful.
1: test:provincies (Multi Polygon)

But $ ogrinfo -al test.gml ONLY returns the bbox info (and NOT the features):

$ ogrinfo -al test.gml
INFO: Open of `test.gml'
      using driver `GML' successful.

Layer name: test:provincies
Geometry: Multi Polygon
Feature Count: 0
Extent: (61331.730481, 324068.944790) - (218326.962960, 413496.608860)
Layer SRS WKT:
PROJCRS["Amersfoort / RD New",
    BASEGEOGCRS["Amersfoort",
        DATUM["Amersfoort",
            ELLIPSOID["Bessel 1841",6377397.155,299.1528128,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4289]],
    CONVERSION["RD New",
        METHOD["Oblique Stereographic",
            ID["EPSG",9809]],
        PARAMETER["Latitude of natural origin",52.1561605555556,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",5.38763888888889,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9999079,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",155000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",463000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting (X)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing (Y)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["Engineering survey, topographic mapping."],
        AREA["Netherlands - onshore, including Waddenzee, Dutch Wadden Islands and 12-mile offshore coastal zone."],
        BBOX[50.75,3.2,53.7,7.22]],
    ID["EPSG",28992]]
Data axis to CRS axis mapping: 1,2
Geometry Column = geometry
gml_id: String (0.0) NOT NULL
fid: Integer64 (0.0)
PROVC: Integer64 (0.0)
PROVC_NM: String (0.0)
INW_T: Integer64 (0.0)

@rduivenvoorde rduivenvoorde added Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server labels Feb 1, 2021
@elpaso elpaso self-assigned this Feb 3, 2021
elpaso added a commit to elpaso/QGIS that referenced this issue Feb 3, 2021
Fixes qgis#41292 QGISserver WFS returns invalid GML in case of cascading WFS
@frippe12573
Copy link

frippe12573 commented Feb 3, 2021

waiting for the built release, this solution/workaround worked to me: [https://github.com//issues/25847]

@rduivenvoorde
Copy link
Contributor Author

@elpaso just wondering: should you really replace the ':' with a '-'?

Because you are rewriting the schema of the xml in that way. While I think if you cascade a WFS I would have hoped that I just receive the same gml as I would receive from the original WFS.
In the way it is handled in your PR for example, I cannot use the same filters because the element namespace/names have in changed.

Would it not be better to ONLY add a qgs-namespace if there is NO namespace? And IF there is a namespace, leave it as is?

In that way applications which count on a xml schema would still work?

nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Mar 14, 2021
Fixes qgis#41292 QGISserver WFS returns invalid GML in case of cascading WFS

(cherry picked from commit 65b272d)
nyalldawson pushed a commit that referenced this issue Mar 19, 2021
Fixes #41292 QGISserver WFS returns invalid GML in case of cascading WFS

(cherry picked from commit 65b272d)
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

Successfully merging a pull request may close this issue.

3 participants