[GIS] GeoServer & QGIS – Using GeoJSON in a WFS request

geojsongeoserverjsonqgiswfs

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

Best Answer

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

Related Question