5

I’m running QGIS 2.18.15 against Geoserver 2.12.1 (full version details below). I have a custom layer serving a single feature type with an Id, Location (geometry) and name (see GML below). When I try ‘Add WFS layer’ pointing to the geoserver I get the errors (see below)

The QGIS error references Complex Features, which I’ve seen elsewhere cannot be imported directly.

If this is true, how can I get my feature layer to integrate with QGIS?

I’ve seen reference to GDAL and GMLAS, although the later seems to be a command line tool for XML to GML conversion.

If this is not the way to go, can QGIS be convinced to accept a Geometry/Point?

QGIS error

2018-02-20T11:12:50 1   Analysis of DescribeFeatureType response failed for url  srsname='EPSG:4326' typename='trueDb:Pole' url='http://localhost:8080/geoserver/wfs' version='auto' table="" sql=: it is probably a schema for Complex Features

And in the geoserver log

 20 Feb 11:12:38 INFO [org.geoserver.wfs] - 
Request: getServiceInfo
20 Feb 11:12:38 INFO [org.geoserver.wfs] - 
Request: getCapabilities
    acceptVersions:
        version[0] = 2.0.0version[0] = 1.1.0version[0] = 1.0.0
    baseUrl = http://localhost:8080/geoserver/
    service = WFS
20 Feb 11:12:50 INFO [org.geoserver.wfs] - 
Request: getServiceInfo
20 Feb 11:12:50 INFO [org.geoserver.wfs] - 
Request: getCapabilities
    acceptVersions:
        version[0] = 2.0.0version[0] = 1.1.0version[0] = 1.0.0
    baseUrl = http://localhost:8080/geoserver/
    service = WFS
20 Feb 11:12:50 INFO [org.geoserver.wfs] - 
Request: getServiceInfo
20 Feb 11:12:50 INFO [org.geoserver.wfs] - 
Request: describeFeatureType
    service = WFS
    version = 2.0.0
    baseUrl = http://localhost:8080/geoserver/
    typeName[0] = {trueDb}Pole
    outputFormat = application/gml+xml; version=3.2
20 Feb 11:12:50 WARN [org.geoserver.wfs] - Could not build xml schema for type: Pole
java.lang.NullPointerException: Could not find a type for property: Location of type: org.opengis.geometry.primitive.Point
…

GML result of manual browser request

<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs" xmlns:wfs="http://www.opengis.net/wfs" xmlns:trueDb="trueDb" xmlns:gml="http://www.opengis.net/gml"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="trueDb http://localhost:8080/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=trueDb%3APole http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
<gml:boundedBy>
<gml:null>unknown</gml:null>
</gml:boundedBy>
<gml:featureMember>
<trueDb:Pole fid="1425580">
<trueDb:Location>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">-2.48143876,51.37922549</gml:coordinates>
</gml:Point>
</trueDb:Location>
<trueDb:Name>GPS0017</trueDb:Name>
</trueDb:Pole>
</gml:featureMember>
….

Versions

QGIS
QGIS version
2.18.15
QGIS code branch
Release 2.18
Compiled against Qt
4.8.6
Running against Qt
4.8.6
Compiled against GDAL/OGR
2.1.3
Running against GDAL/OGR
2.1.3
Compiled against GEOS
3.6.2-CAPI-1.10.2
Running against GEOS
3.6.1-CAPI-1.10.1 r0
PostgreSQL Client Version
9.3.4
SpatiaLite Version
4.3.0a
QWT Version
6.1.3
PROJ.4 Version
492
QScintilla2 Version
2.9.3

GeoServer

   Build Information
            GeoServer Version
        2.12.1
            Git Revision
        5927e49e781ddcdbf9213d32a439418347c17480
            Build Date
        21-Nov-2017 22:02
            GeoTools Version
        18.1 (rev 306cf3bdde1bee0110dc1c3ba77819f1e294a45b)
            GeoWebCache Version
        1.12.1 (rev 1.12.x/22d18b47c9e80316d563c28d280602cb3dde624c)

DescribeFeatureType request

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:trueDb="trueDb" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="trueDb">
  <xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.2.1/gml.xsd"/>
</xsd:schema>

Groovy Code to generate the feature

geometryFactory = JTSFactoryFinder.getGeometryFactory(null)

SimpleFeature toOpenGIS(Feature feature) {
        def point = geometryFactory.createPoint(new Coordinate(feature.geometry.asPoint().location.longitude,
                feature.geometry.asPoint().location.latitude))
        builder.set("Location", point)
        builder.set("Name", feature.name)
        builder.buildFeature(feature.id)
    }
5
  • Can you share the output of a call to DescribeFeatureType for that layer too? Commented Feb 20, 2018 at 12:33
  • Read this files.titellus.net/vbox/qgisgmlas.pdf and try the development version of QGIS that will become version 3.0.
    – user30184
    Commented Feb 20, 2018 at 12:39
  • @user30184 thanks. I have successfully used the latest QGIS dev and GML Schema import plugin to load by point data into a layer. However, I want to be able to load the layer directly via WFS. So can anyone explain why, when using the above code to create the feature, which uses a com.vividsolutions.jts.geom.Point geometry descriptor, can WFS not find the appropriate type for xml transformation and complains that it cannot find the type org.opengis.geometry.primitive.Point ?
    – sdev
    Commented Feb 22, 2018 at 12:20
  • That is probably worth another question. Java and JTS folks may not find this new question from the comment of the original question dealing with QGIS.
    – user30184
    Commented Feb 22, 2018 at 12:28
  • Possibly, but I'm not yet convinced it's directly a code issue. I've looked at the example layers provided with the geoserver installation and they appear to handle the geometry types fine. Maybe it's related to the geoserver config for WFS or the layer?
    – sdev
    Commented Feb 22, 2018 at 12:36

1 Answer 1

3

Support for complex feature GML provided by servers such as GeoServer (through WFS) in QGIS is very limited in version QGIS 2.n

If this is true, how can I get my feature layer to integrate with QGIS?

Upgrade to QGIS 3 and take advantage of the QGIS GML Application Schema Toolbox plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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