[Qgis-user] QGIS Server: Parsing WFS capabilites with JavaScript
Aguilar Bolivar, Rosa (UT-ITC)
r.aguilar at utwente.nl
Mon Oct 30 22:16:00 PDT 2023
Hi,
I have used a simple DOMParser
const xmlParser = new DOMParser();
const xmlText = xmlParser.parseFromString(XmlCapText, 'text/xml');
Cheers,
Rosa
-----------------------------------------------------------------
Dr. Rosa Aguilar
University of Twente
Faculty of Geoinformation Science and Earth Observation
Connect with me on LinkedIn<https://www.linkedin.com/in/rosamaguilar/?locale=en_US>
https://rosaguilar.github.io<https://rosaguilar.github.io/>
-----------------------------------------------------------------
The essential is invisible to the eye. Saint-Exupéry
From: QGIS-User <qgis-user-bounces at lists.osgeo.org> On Behalf Of Jorge Gustavo Rocha via QGIS-User
Sent: Monday, October 30, 2023 8:36 PM
To: qgis-user at lists.osgeo.org
Subject: Re: [Qgis-user] QGIS Server: Parsing WFS capabilites with JavaScript
Hi Jakob,
You can try jsonix. I use something like:
var Jsonix = require('jsonix').Jsonix;
var XLink_1_0 = require('w3c-schemas').XLink_1_0;
var OWS_1_0_0 = require('ogc-schemas').OWS_1_0_0;
var OWS_1_1_0 = require('ogc-schemas').OWS_1_1_0;
var WFS_1_0_0 = require('ogc-schemas').WFS_1_0_0;
var WFS_1_1_0 = require('ogc-schemas').WFS_1_1_0;
var WFS_2_0 = require('ogc-schemas').WFS_2_0;
var Filter_1_0_0 = require('ogc-schemas').Filter_1_0_0;
var Filter_1_1_0 = require('ogc-schemas').Filter_1_1_0;
var Filter_2_0 = require('ogc-schemas').Filter_2_0;
var GML_1_0_0 = require('ogc-schemas').GML_1_0_0;
var GML_2_1_2 = require('ogc-schemas').GML_2_1_2;
var GML_3_1_1 = require('ogc-schemas').GML_3_1_1;
var GML_3_2_0 = require('ogc-schemas').GML_3_2_0;
var GML_3_2_1 = require('ogc-schemas').GML_3_2_1;
var SMIL_2_0 = require('ogc-schemas').SMIL_2_0;
var SMIL_2_0_Language = require('ogc-schemas').SMIL_2_0_Language;
var CSW_2_0_2 = require('ogc-schemas').CSW_2_0_2;
var DC_1_1 = require('ogc-schemas').DC_1_1;
var DCT = require('ogc-schemas').DCT;
var XMLSchema = require('./mappings/XMLSchema').XMLSchema;
var context = new Jsonix.Context([
XLink_1_0,
OWS_1_0_0,
OWS_1_1_0,
WFS_1_0_0,
WFS_1_1_0,
WFS_2_0,
Filter_1_0_0,
Filter_1_1_0,
Filter_2_0,
GML_1_0_0,
GML_2_1_2,
GML_3_1_1,
GML_3_2_0,
GML_3_2_1,
SMIL_2_0,
SMIL_2_0_Language,
CSW_2_0_2,
DC_1_1,
DCT,
XMLSchema
]);
var unmarshaller = context.createUnmarshaller();
Later, you can transform WFS response to JSON, like:
const response = responseBuffer.toString('utf8');
var result = unmarshaller.unmarshalString(response);
Not so easy, but it works.
Regards,
Jorge Gustavo
On 30/10/23 14:11, Jakob Miksch via QGIS-User wrote:
Dear QGIS Server people,
I have a QGIS Server running. I would like to access the WFS Capabilities with JavaScript, more specifically I would like to know which WFS layers are published by QGIS Server. Unfortunately, QGIS Server only supports WFS 1.0.0 and 1.1.0. But the only parser for WFS capabilities I have found only support WFS 2.0.0 ( https://github.com/GastonZalba/ol-wfs-capabilities ).
Does anyone have a hint how to parse the WFS Capabilities from QGIS Server with JavaScript?
best regards,
Jakob
[cid:image001.png at 01DA0BC1.B74420E0]
Jakob Miksch
Consultant
+49 170 9036956
siticom.online
siticom GmbH * Werner-von-Siemens-Straße 2-6 * 76646 Bruchsal * Deutschland
Geschäftsführer: Jürgen Hatzipantelis, Stefan Höltken
Sitz der Gesellschaft: Weiterstadt * Amtsgericht Darmstadt * HRB 9276
Umsatzsteuer-ID Nr.: DE 197 925 589
_______________________________________________
QGIS-User mailing list
QGIS-User at lists.osgeo.org<mailto:QGIS-User at lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20231031/1ea14ad8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 14960 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20231031/1ea14ad8/attachment-0001.png>
More information about the QGIS-User
mailing list