0

I'm trying to load a WFS Layer in QGIS. I requst the data from my GeoServer and would like to import the data as GeoJSON.

I can export my data in the layer preview section as GeoJSON. Everything works fine.

But i am unable to display my data in QGIS. I tried to add the "&outputFormat=application%2Fjson" at the GetFeature request.

I think my issue belongs to this similar question but the author did not answer the question of @nmtoken if the WFS GetCapabilities request for the service is listed GeoJSON as a GetFeature ResultFormat. In my case, the format is listed.

Here is the output of the GetCapabilities request:

<ows:Operation name="GetFeature">
   .
   .
   <ows:Parameter name="outputFormat">
     <ows:AllowedValues>
      <ows:Value>application/gml+xml; version=3.2</ows:Value>
      <ows:Value>GML2</ows:Value>
      <ows:Value>KML</ows:Value>
      <ows:Value>SHAPE-ZIP</ows:Value>
      <ows:Value>application/json</ows:Value>
      <ows:Value>application/vnd.google-earth.kml xml</ows:Value>
      <ows:Value>application/vnd.google-earth.kml+xml</ows:Value>
      <ows:Value>csv</ows:Value>
      <ows:Value>gml3</ows:Value>
      <ows:Value>gml32</ows:Value>
      <ows:Value>json</ows:Value>
      <ows:Value>text/xml; subtype=gml/2.1.2</ows:Value>
      <ows:Value>text/xml; subtype=gml/3.1.1</ows:Value>
      <ows:Value>text/xml; subtype=gml/3.2</ows:Value>
     </ows:AllowedValues>
   </ows:Parameter>
   .
   .

Please give me a helping hand here, maybe it's not possible to load my data as GeoJSON through a WFS because it will always provide the data as XML? I tested it with WFS 1.0.0, 1.1.0 and 2.0.0

Versions:

QGIS 3.2. 
GeoServer 2.12.1
  • 1
    Since both GeoServer and QGIS fully understand the GML spec why do you want to force them to work in GeoJson which is not native to either of them? – Ian Turton Aug 22 '18 at 9:50
  • The thing is a little bit more complex. I am working with complex features and QGIS is not able to handle it. Strangely enough, when i export the features as a GeoJSON from the GeoServer and import the file in QGIS, it works. My idea of a workaround: import the data via a WFS as GeoJSON. – elbarado Aug 22 '18 at 9:57
  • 1
    If you have complex features then perhaps you would like to test this github.com/BRGM/gml_application_schema_toolbox – user30184 Aug 22 '18 at 12:06
  • @user30184 thanks, i've imported my data via the plugin. Now it works. – elbarado Aug 24 '18 at 11:39
  • Great. Would you mind to write a few lines about what you did as an anwer? – user30184 Aug 24 '18 at 11:41
1

I had to deviate from the orignal plan to load my data as GeoJSON through a WFS. As @ian-turton mentioned above it makes no sense to use GeoJSOn here because GeoServer and QGIS doing a good job with GML.

So I tried the GML Application Schema toolbox QGIS plugin recommended by @user30184.

"This plugin allows then to extract each “Complex Feature” from a GML document and to store it as a row in a vector layer." - GML application schema toolbox doc

My configuration on the GeoServer:

  • I'm working with the App Schema tutorial data
  • The complex data is stored in a Java Property file which contains Feature information
  • The data store contains the mapping file of the complex features

Steps you have to do within the plugin:

  1. Select the source of the data: WFS
  2. Connect to the GeoServer
  3. Selection of FeatureTypes you want to map
  4. Load in XML mode

As you can see in the screenshot, my complex features are stored in three separate layer (left). The features attributes table (right) shows the complex relationships.

Output of the working plugin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.