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

WFS Layers Not Exporting (same issue than #773) #993

Open
sophiatran-obvyamaska opened this issue Mar 22, 2022 · 17 comments
Open

WFS Layers Not Exporting (same issue than #773) #993

sophiatran-obvyamaska opened this issue Mar 22, 2022 · 17 comments

Comments

@sophiatran-obvyamaska
Copy link

Hi,

I have the same problem than issue #773 (the codes in index.html and layers.js are refering to JSON even though I haven't checked 'Encode in JSON').
My WFS layers don't show up in the preview nor when are exported.
The WMS layers of the same server work.

The JSONP in GeoServer in enabled, but nothing changed.
Is there anything else we can do to make it work?

Thanks.

@boesiii
Copy link
Contributor

boesiii commented Mar 28, 2022

I am not very familiar with WFS layers and have never used them in a map. Do you really need WFS? Why not try to get the WFS layer in shapefile format and see if you are able to export to a proper web map using the shapefile? I would first try it without WFS.

@boesiii
Copy link
Contributor

boesiii commented Mar 28, 2022

Are you able to share the WFS server info so I can test it on my end?

@sophiatran-obvyamaska
Copy link
Author

sophiatran-obvyamaska commented Mar 29, 2022

Thanks for the reply.

If the WFS layers are transformed into JSON files ('Encore in JSON' checked), I have a proper web map, but I'm trying to have all my layers online and stored in a server for work purpose.

I'm just not sure how to change the coding for it to reference my WFS layers instead of some JSON layers that aren't created ('Encode in JSON' not checked).

Here the WFS server info : http://yxlfj798.hostpapavps.net:8181/geoserver/ows?service=wfs&version=2.0.0&request=GetCapabilities.

If you need access to it, a temporary account can be created.

@tomchadwin
Copy link
Collaborator

Is the WFS server available over HTTPS, rather than HTTP? Most browsers these days, if you are looking at a local file, will block HTTP traffic. You'll have the same issue if you put the exported webmap online and try to view it over HTTPS - you can't mix secure and insecure content.

You can check this by pressing F12 in your browser, and looking for error messages. Let us know if you find anything.

@sophiatran-obvyamaska
Copy link
Author

sophiatran-obvyamaska commented Mar 30, 2022

I don't think I have an issue with that.
I did try to code a little web map with the server (some WFS layers) on a OSM tile and it worked.

I'm not sure how the plugin processed the WFS layers.

@magerlin
Copy link

magerlin commented May 5, 2022

I have exactly the same problem. In the attached project I have 3 different WFS layers from 3 different sources and none of them can be shown in Leaflet except if I tick them to save as json.

Mastra test.zip

In the generated index.html they are coded like this when NOT ticked save as json:

`

<script src='http://vmgeoserver.vd.dk/geoserver/VD/ows?version=1.1.0?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=VD:MASTRA_NOEGLETAL_GEO&SRSNAME=EPSG:4326&outputFormat=text%2Fjavascript&format_options=callback%3AgetMastrangletal_1Json'></script>

 


`

@tomchadwin
Copy link
Collaborator

tomchadwin commented May 5, 2022

@magerlin Look at the browser console. You can see an error which comes from a network request. Look at the network tab, and find the request to your WFS. The reponse is this:

<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
   <ServiceException code="InvalidParameterValue" locator="outputFormat">
      Failed to find response for output format text/javascript
</ServiceException></ServiceExceptionReport>

I don't know for sure, but it's possible that you haven't configured your server to support JSONP which is what qgis2web uses.

@tomchadwin
Copy link
Collaborator

@sophiatran-obvyamaska Can you do the same? Export the map, and then look for errors in the browser console? I see that you have configured JSONP, so it must be a different issue.

@magerlin
Copy link

magerlin commented May 5, 2022

I am only having it locally on my PC right now. Looking at the browser console it says:

leaflet.js:5 Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead. Error at file:///C:/Users/MAP/AppData/Local/Temp/qgis2web/qgis2web_2022_05_05-09_47_11_008454/js/leaflet.js:5:3222 at Function.S.extend (file:///C:/Users/MAP/AppData/Local/Temp/qgis2web/qgis2web_2022_05_05-09_47_11_008454/js/leaflet.js:5:3240) at file:///C:/Users/MAP/AppData/Local/Temp/qgis2web/qgis2web_2022_05_05-09_47_11_008454/js/leaflet.pattern.js:6:34 at file:///C:/Users/MAP/AppData/Local/Temp/qgis2web/qgis2web_2022_05_05-09_47_11_008454/js/leaflet.pattern.js:6:7077 (anonymous) @ leaflet.js:5 DevTools failed to load source map: Could not load content for file:///C:/Users/MAP/AppData/Local/Temp/qgis2web/qgis2web_2022_05_05-09_47_11_008454/js/Autolinker.min.js.map: System error: net::ERR_FILE_NOT_FOUND

The generated folder is here:
qgis2web_2022_05_05-09_47_11_008454.zip

@tomchadwin
Copy link
Collaborator

image

image

From memory, Failed to find response for output format text/javascript is the MIME-type for JSONP, to that error suggests that the WFS server is not configured for JSONP. Is it Geoserver?

@magerlin
Copy link

magerlin commented May 5, 2022

All 3 examples are from public map services in either Denmark or Iceland and I do not know more than what can be read from the source links. But sibe two of them have the text "geoserver" in the link address I would assume it was geoserver?

For one of the examples the link is:

`

<script src='http://vmgeoserver.vd.dk/geoserver/VD/ows?version=1.1.0?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=VD:MASTRA_NOEGLETAL_GEO&SRSNAME=EPSG:4326&outputFormat=text%2Fjavascript&format_options=callback%3AgetMastrangletal_1Json'></script>

 


`

@tomchadwin
Copy link
Collaborator

If it's not your source, then it's going to be a problem. The issue, as I understand it, is that JSONP has very much fallen out of favour. When I first wrote the WFS code back in the qgis2leaf days, it was best practice. I think it is less and less used these days.

This proably means that qgis2web development is required, making JSONP optional via a checkbox for each WFS layer. It might also be worth contacting the WFS server providers, and ask them if they would consider enabling JSONP support.

@magerlin
Copy link

magerlin commented May 5, 2022

I am about to update an old web map presenting this source:
<script src='http://vmgeoserver.vd.dk/geoserver/VD/ows?version=1.1.0?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=VD:MASTRA_NOEGLETAL_GEO&SRSNAME=EPSG:4326&outputFormat=text%2Fjavascript&format_options=callback%3AgetMastrangletal_1Json'></script>

I am updating because background map sources were not functioning anymore but I am actually pretty sure that the source above was functioning. Unfortunately I have overwritten the old index.html in the process but I will se if I can make our IT department restore the old version.

@magerlin
Copy link

magerlin commented May 5, 2022

It is apparently not about the server but how QGIS write the code to the WFS and probably it is about WFS versions

I happened to find an old QGIS project linking to exactly same data source and it works when exporting in QGIS2WEB.

By deleting the entry to the data source in my QGIS browser window and recreating it without any information on WFS version I made QGIS load the WFS layer like this:

image

And now it works in QGIS2WEB :-)

I feel the QGIS WFS is somewhat unreliable - I often get all features shown twice on top of each other in the map canvas. And making changes inside the QGIS browser does not always work - it is better to delete and recreate....

@tomchadwin
Copy link
Collaborator

Ah! Interesting, amnd I have no real explanation, I'm afraid. Glad you got it sorted, though.

I don't know if any of this helps you, @sophiatran-obvyamaska?

@sophiatran-obvyamaska
Copy link
Author

Hi,

Actually, I did figured it out.
In the file layers.js that the plugin generated, some commas and lines are missing to call the server and the layers.
That happens for each WFS layer in the projet.

What the plugin wrote:
image

The little change I did:
image

Thanks for the follow-up :)

@riccardoklinger
Copy link
Collaborator

unfortunately this problem is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants