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 1.1: issue with axis order #36584

Closed
ismailsunni opened this issue May 20, 2020 · 15 comments · Fixed by #41242
Closed

QGIS Server WFS 1.1: issue with axis order #36584

ismailsunni opened this issue May 20, 2020 · 15 comments · Fixed by #41242
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server

Comments

@ismailsunni
Copy link
Contributor

Describe the bug

I am trying to use QGIS Server to serve a WFS with a time dimension and view it using the new QGIS temporal handler.

Unfortunately, the features are not shown on QGIS. I checked the requested URL with QGIS Network Logger plugin, and this is the request:

http://localhost:8380/?LAYERS=eq-filtered&ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&TYPENAME=eq-filtered&SRSNAME=EPSG:4326&BBOX=-0.0985539665264239,119.31367704126752471,1.21353055886411432,120.62576156665805627,EPSG:4326

and this is the returns

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:qgs="http://www.qgis.org/gml" 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:8380/?LAYERS=eq-filtered&amp;ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0&amp;SRSNAME=EPSG:4326&amp;SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=eq-filtered&amp;OUTPUTFORMAT=text/xml; subtype%3Dgml/3.1.1">
    <gml:boundedBy>
        <gml:Envelope srsName="EPSG:4326">
            <gml:lowerCorner>-0.09855397 119.31367704</gml:lowerCorner>
            <gml:upperCorner>1.21353056 120.62576157</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
</wfs:FeatureCollection>

The BBOX seems wrong (longitude and latitude in the wrong place).

I tried to "fix" the BBOX, like this:

http://localhost:8380/?LAYERS=eq-filtered&ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&TYPENAME=eq-filtered&SRSNAME=EPSG:4326&BBOX=119.31367704126752471,-0.0985539665264239,120.62576156665805627,1.21353055886411432,EPSG:4326

and I got the expected result:

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:qgs="http://www.qgis.org/gml" 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:8380/?LAYERS=eq-filtered&amp;ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0&amp;SRSNAME=EPSG:4326&amp;SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=eq-filtered&amp;OUTPUTFORMAT=text/xml; subtype%3Dgml/3.1.1">
    <gml:boundedBy>
        <gml:Envelope srsName="EPSG:4326">
            <gml:lowerCorner>119.31367704 -0.09855397</gml:lowerCorner>
            <gml:upperCorner>120.62576157 1.21353056</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
    <gml:featureMember>
        <qgs:eq-filtered gml:id="eq-filtered.52">
            <gml:boundedBy>
                <gml:Envelope srsName="EPSG:4326">
                    <gml:lowerCorner>119.9 0.21</gml:lowerCorner>
                    <gml:upperCorner>119.9 0.21</gml:upperCorner>
                </gml:Envelope>
            </gml:boundedBy>
            <qgs:geometry>
                <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:4326">
                    <pos xmlns="http://www.opengis.net/gml" srsDimension="2">119.9 0.21</pos>
                </Point>
            </qgs:geometry>
            <qgs:id>20140923172220</qgs:id>
            <qgs:time>2014-09-23 10:15:20</qgs:time>
            <qgs:location_description>Sulteng</qgs:location_description>
            <qgs:magnitude>5.1</qgs:magnitude>
            <qgs:depth>30</qgs:depth>
        </qgs:eq-filtered>
    </gml:featureMember>
// ommited
    <gml:featureMember>
        <qgs:eq-filtered gml:id="eq-filtered.3288">
            <gml:boundedBy>
                <gml:Envelope srsName="EPSG:4326">
                    <gml:lowerCorner>119.68 -0.05</gml:lowerCorner>
                    <gml:upperCorner>119.68 -0.05</gml:upperCorner>
                </gml:Envelope>
            </gml:boundedBy>
            <qgs:geometry>
                <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:4326">
                    <pos xmlns="http://www.opengis.net/gml" srsDimension="2">119.68 -0.05</pos>
                </Point>
            </qgs:geometry>
            <qgs:id>20190604073528</qgs:id>
            <qgs:time>2019-06-04 00:35:28</qgs:time>
            <qgs:location_description>Sulawesi Tengah</qgs:location_description>
            <qgs:magnitude>4.1</qgs:magnitude>
            <qgs:depth>10</qgs:depth>
        </qgs:eq-filtered>
    </gml:featureMember>
</wfs:FeatureCollection>

So, there is a problem either in the QGIS Server or the temporal handling of QGIS. The WMS from the same QGIS Server itself is working fine.

I tested with a WFS from a GeoServer. It does not have a time field as Datetime, but a string, so I created one from it. It's working fine on QGIS temporal handling. So, probably the problem is on the QGIS Server one. Or perhaps there is a different way to handle WFS server?

How to Reproduce

  1. Setup a QGIS Server with a vector layer that has a time attribute
  2. Access the WMS and WFS from QGIS (master)

QGIS and OS versions

QGIS version 3.13.0-Master QGIS code revision 53091b3
Compiled against Qt 5.9.5 Running against Qt 5.9.5
Compiled against GDAL/OGR 2.2.3 Running against GDAL/OGR 2.2.3
Compiled against GEOS 3.7.1-CAPI-1.11.1 Running against GEOS 3.7.1-CAPI-1.11.1 27a5e771
Compiled against SQLite 3.22.0 Running against SQLite 3.22.0
PostgreSQL Client Version 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1) SpatiaLite Version 4.3.0a
QWT Version 6.1.3 QScintilla2 Version 2.10.2
Compiled against PROJ 5.2.0 Running against PROJ Rel. 5.2.0, September 15th, 2018
OS Version Ubuntu 18.04.4 LTS This copy of QGIS writes debugging output.
Active python plugins QuickOSM; quick_map_services; qgisnetworklogger; latlontools; Mergin; qgis2web; QuickWKT; qfieldsync; MetaSearch; processing

Additional context

@ismailsunni ismailsunni added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 20, 2020
@nyalldawson
Copy link
Collaborator

It's definitely NOT an issue in the new client side temporal code -- it's either an issue in the wfs provider or qgis server

@rouault
Copy link
Contributor

rouault commented May 20, 2020

The BBOX seems wrong (longitude and latitude in the wrong place).

no, that's correct. With WFS >= 1.1, EPSG:4326 is in latitude, longitude order. However using "EPSG:4326" isn't recommended, and "urn:ogc:def:crs:EPSG::4326" should rather be used to avoid any ambiguity on axis order. Might be a QGIS server issue. You could probably force to WFS 1.0 to avoid that issue

@gioman gioman added the Feedback Waiting on the submitter for answers label May 21, 2020
@ismailsunni
Copy link
Contributor Author

Hi @rouault @nyalldawson
Thanks, I set it to WFS 1.0 and the issue is gone. Does it mean that QGIS Server only serves WFS 1.0?
And where can use/set urn:ogc:def:crs:EPSG::4326 on the request? I couldn't find it on the CRS menu to setup the QGIS Server.

@rouault rouault changed the title WFS with Time Coordinate Request is Inversed QGIS Server WFS 1.1: issue with axis order May 25, 2020
@rouault
Copy link
Contributor

rouault commented May 27, 2020

Does it mean that QGIS Server only serves WFS 1.0?

Looking closer, it has code to support 1.0 and 1.1. But 1.1 support seems to be currently non-compliant regarding EPSG axis order.

@elpaso elpaso added the Server Related to QGIS server label Oct 14, 2020
@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Dec 23, 2020
@ismailsunni
Copy link
Contributor Author

I think the comment from @rouault (#36584 (comment)) has enough information for the issue.

@github-actions github-actions bot removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jan 11, 2021
@gioman gioman removed the Feedback Waiting on the submitter for answers label Jan 20, 2021
@elpaso elpaso self-assigned this Jan 27, 2021
elpaso added a commit to elpaso/QGIS that referenced this issue Jan 28, 2021
elpaso added a commit to elpaso/QGIS that referenced this issue Jan 29, 2021
Follows GeoServer convention, fixes qgis#36584
@elpaso
Copy link
Contributor

elpaso commented Jan 29, 2021

@ismailsunni would you please have a look to my PR if that fixes your issues?

@ismailsunni
Copy link
Contributor Author

Hi @elpaso how can I test QGIS Server from my own build? I usually use a docker image for QGIS Server. Thanks

@elpaso
Copy link
Contributor

elpaso commented Feb 1, 2021

qgis_mapserver binary

@elpaso
Copy link
Contributor

elpaso commented Feb 3, 2021

@ismailsunni gentle ping

@ismailsunni
Copy link
Contributor Author

hi @elpaso
thanks for the hint, I managed to run it. I got the landing page! But how can I test it on QGIS?

I tried several URLs for the WFS (and WMS) like localhost:8000 but it doesn't work. I tried to check with the URL on the landing page, like

http://localhost:8000/project/7c47541c4d7e51726abe31189d12e939

I can get the capabilities (using postman), but I can't add the URL on QGIS (it says Download of capabilities failed: Connection refused or Download of landing page failed: Connection refused

@elpaso
Copy link
Contributor

elpaso commented Feb 3, 2021

forget the landing page and pass MAP=...&SERVICE=WMS...

@ismailsunni
Copy link
Contributor Author

Ah, thanks @elpaso

I tried with the same project as in my first comment, but it still gives me the same result.

http://localhost:8000/?LAYERS=eq-filtered&ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&TYPENAME=eq-filtered&SRSNAME=EPSG:4326&BBOX=-0.0985539665264239,119.31367704126752471,1.21353055886411432,120.62576156665805627,EPSG:4326

I got:

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:qgs="http://www.qgis.org/gml" 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:8000/?LAYERS=eq-filtered&ACCEPTVERSIONS=2.0.0,1.1.0,1.0.0&SRSNAME=EPSG:4326&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=eq-filtered&OUTPUTFORMAT=text/xml; subtype%3Dgml/3.1.1">
<gml:boundedBy>
<gml:Envelope srsName="EPSG:4326">
<gml:lowerCorner>-0.09855397 119.31367704</gml:lowerCorner>
<gml:upperCorner>1.21353056 120.62576157</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
</wfs:FeatureCollection>

@elpaso
Copy link
Contributor

elpaso commented Feb 3, 2021

Are you testing #41242 ?

We are now following GeoServer conventions and EPSG:4326 is supposed to be interpreted as LON-LAT order.

I don't know what you are testing but it seems to me -0.0985539665264239,119.31367704126752471 is LAT-LON

@ismailsunni
Copy link
Contributor Author

hi @elpaso

Yes, I use your branch.

And yes, it was my mistake. I have checked again the URL, it is fixed now.

I also have tested on QGIS, I can see my features now (I can't see it previously, like I mentioned in my first comment above).

Thanks for the fix!

elpaso added a commit to elpaso/QGIS that referenced this issue Feb 17, 2021
Follows GeoServer convention, fixes qgis#36584

Cherry-picked from master e967fd9
elpaso added a commit to elpaso/QGIS that referenced this issue Feb 17, 2021
Fixes qgis#36584

Cherry-picked from master 84f61ff.
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Feb 19, 2021
Follows GeoServer convention, fixes qgis#36584

Cherry-picked from master e967fd9
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Feb 19, 2021
nyalldawson pushed a commit that referenced this issue Feb 19, 2021
Follows GeoServer convention, fixes #36584

Cherry-picked from master e967fd9
nyalldawson pushed a commit that referenced this issue Feb 19, 2021
Fixes #36584

Cherry-picked from master 84f61ff.
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.

5 participants