1

I would like to read a WFS published using QGIS server, with the plugin Leaflet-WFST but an error occurs when the plugin is trying to read the geometry.

Error :

uncaught exception: unknown child element Point

Result of the WFS POST request:

<gml:boundedBy xmlns:gml="http://www.opengis.net/gml">
    <gml:Box srsName="EPSG:4326">
        <gml:coordinates cs="," ts=" ">-4.07446736,52.4326541
            -4.07446736,52.4326541</gml:coordinates>
    </gml:Box>
</gml:boundedBy>
<qgs:geometry xmlns:qgs="http://www.qgis.org/gml">
    <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:4326">
        <coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">-4.07446736,52.4326541</coordinates>
    </Point>
</qgs:geometry>
<qgs:_URI xmlns:qgs="http://www.qgis.org/gml">uuid:858df484-a17e-45b0-b740-0639f530d946</qgs:_URI>
<qgs:SITE_DETAILS_OBSERVER xmlns:qgs="http://www.qgis.org/gml"/>
<qgs:crationdate xmlns:qgs="http://www.qgis.org/gml">2019-01-24T13:35:37</qgs:crationdate>
<qgs:diamtrunk xmlns:qgs="http://www.qgis.org/gml">20</qgs:diamtrunk>
<qgs:heighttrunkmesure xmlns:qgs="http://www.qgis.org/gml">1.3</qgs:heighttrunkmesure>
<qgs:species xmlns:qgs="http://www.qgis.org/gml">Pinus-sylvestris</qgs:species>
<qgs:circumference xmlns:qgs="http://www.qgis.org/gml">62.8318530717959</qgs:circumference>
<qgs:crownxaxis xmlns:qgs="http://www.qgis.org/gml">3</qgs:crownxaxis>
<qgs:crownyaxis xmlns:qgs="http://www.qgis.org/gml">1</qgs:crownyaxis>
<qgs:crownorientation xmlns:qgs="http://www.qgis.org/gml">20.67</qgs:crownorientation>.

Additional information:

Points came from a PostGIS database (postgresql 9.5 postgis 2.2) then publish using QGIS 2.18.16

The WFS can be read perfectly using a remote computer and QGis desktop

The GetCapabilities of the service: http://54.38.33.23/cgi-bin/qgis_mapserv.fcgi?SERVICE=WFS&version=1.0.0&REQUEST=GetCapabilities&MAP=/home/sebastien/odkResult/indTrees.qgs

Leaflet code:

var layer2=new L.WFS({
                url: 'http://54.38.33.23/cgi-bin/qgis_mapserv.fcgi?MAP=/home/sebastien/odkResult/mangroveTrees.qgs',
                //typeNS:"",
                geometryField:'geometry',
                typeName: 'ind_trees',
                crs: L.CRS.EPSG4326,
                style: {
                  color: 'red',
                  weight: 3
                }
            }).addTo(mymap)
6
  • Can you read other WFS services using the plug in? Commented Feb 4, 2019 at 16:27
  • When I try to access the WFS from this codepen: codepen.io/anon/pen/QYMJym i get a CORS error in the browser console (after pressing F12). This may also be contributing factor to the problem. Commented Feb 5, 2019 at 12:55
  • Thank you but is more a copy paste error when I wrote the question. I edited the question. Commented Feb 5, 2019 at 15:53
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review Commented Feb 5, 2019 at 16:58
  • I can read other WFS using the plugin as suggested in the turorial. But every WFS that I tried to read came from mapserver or geoserver I did not find any QGIS server to test. Commented Feb 20, 2019 at 12:05

1 Answer 1

1

I am experiencing the same challenge. I found a difference between qgis wfs and geoserver wfs outputs. geoserver element.tagName returned "gml:Polygon" where qgis returned "Polygon". If you know you will only ever use qgis to publish your wfs then I suppose you could revise line 876 of Leaflet-WFST 1.2.0

from: var parser = this.parsers[element.tagName];

to: var parser = this.parsers["gml:".concat(element.tagName)];

It is working for me but I haven't tested much. It may well break something else.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.