[QGIS-Developer] Loading WFS layers from GeoServer

Ian Turton ijturton at gmail.com
Fri Nov 27 07:35:16 PST 2020


If you are using WFS 2.0 and limits/paging (which I think QGis does behind
the scenes) then GeoServer is going to want a specific primary key for the
view - since most Databases won't let you add a primary key to a view we
fake it with a primary key metadata table (see
https://docs.geoserver.org/stable/en/user/data/database/primarykey.html).
The examples on that page are for PostGIS and Oracle so if you are using a
different table you may need to adapt the DDO scripts (and please do add
back to that page if you work out a new one).

Alternatively, try adding version=1.1.0 to the end of your capabilities
request string that you add into QGis which I think will stop the two
programs agreeing to use the highest version available.

Ian

On Fri, 27 Nov 2020 at 15:20, Paul Wittle <paul.wittle at dorsetcouncil.gov.uk>
wrote:

> Hi,
>
> It is also interesting that when I run the query again using WFS version
> 1.0 and network logging all four requests succeed but the layer is still
> invalid.
>
> The getFeature returns a single feature with the following geometry:
> <gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#27700"
> srsDimension="2">
> <gml:exterior>
> <gml:LinearRing>
> <gml:posList>389814.604 97465.168 389823.18 97454.59 389858.98 97463.67
> 389855.18 97472.01 389849.77 97481.28 389845.792 97486.125 389814.604
> 97465.168</gml:posList>
> </gml:LinearRing>
> </gml:exterior>
> </gml:Polygon>
>
> Does that give any clues?
>
> I'll head off and check it in my 3.16 version now.
> Paul
>
> -----Original Message-----
> From: Paul Wittle
> Sent: 27 November 2020 15:14
> To: rdmailings at duif.net; qgis-developer at lists.osgeo.org
> Subject: RE: [QGIS-Developer] Loading WFS layers from GeoServer
>
> Hi,
>
> I was using the 32 bit version (don't ask) but I've just tried it in the
> 64bit version (although 3.10) with the network logger installed and the
> errors read:
>
> java.lang.RuntimeException: Failed to get property: {
> http://www.opengis.net/wfs/2.0}boundedBy Failed to get property: {
> http://www.opengis.net/wfs/2.0}boundedBy java.io.IOExceptionCannot do
> natural order without a primary key, please add it or specify a manual sort
> over existing attributes
>
> The datasource is GeoServer but GeoServer is connecting to a view in SQL
> Server where the first table in the view is a table with a primary key and
> spatial index.
>
> However I don't really understand because requesting the data in the
> GeoServer layer preview works fine so I assume QGIS is asking something the
> layer preview does not?
>
> Thanks,
> Paul
>
> -----Original Message-----
> From: Richard Duivenvoorde <rdmailings at duif.net>
> Sent: 27 November 2020 15:00
> To: Paul Wittle <P.Wittle at dorsetcc.gov.uk>; qgis-developer at lists.osgeo.org
> Subject: Re: [QGIS-Developer] Loading WFS layers from GeoServer
>
> Hi Paul,
>
> QGIS 3.16 (well, since ... I don not know exactly) has s
> NetworkLogger/Debugger.
> If you hit the F12 button, you will see all WFS-requests that QGIS is
> firing to the server.
> You can 'replay' these in a browser, and see if it returns valid GML (as
> in: save it to disk and then try to open it as vector data).
> Normally QGIS starts with a GetCapabilities request, then a DescribeLayer
> and then a GetFeature. You need that last one.
> In the Network Debugging window you can also see if the server maybe
> returns an error code (as: not 200).
>
> Does the Geoserver-layer preview work? As in can you see the layers there?
>
> Normally WFS/WMS from Geoserver play pretty well together with QGIS.
> Is there something special to the data? (curves, nonvalid geometries, ???)
>
> Regards,
>
> Richard Duivenvoorde
>
>
>
> On 11/27/20 3:48 PM, Paul Wittle wrote:
> > Hi,
> >
> >
> >
> > So the WFS layers do now return correctly from GeoServer in both WMS and
> all WFS formats and I’ve improved various indexes.
> >
> >
> >
> > I also found a plugin called WFS 2.0 Client and tried that; it returned
> the features successfully.
> >
> >
> >
> > Unfortunately that seems to be a one off download method rather than
> adding a live linked layer so it didn’t fix the issue but did prove that
> the GeoServer can return features.
> >
> >
> >
> > I’m still having the same trouble when trying to add the layers to QGIS
> 3.10 though; it just adds a layer with the image icon but of course it
> can’t draw the layer and it loads as a bad layer if you save it in the
> project.
> >
> >
> >
> > Does anyone have any suggestions of what might be the issue?
> >
> >
> >
> > The server does require authentication.
> >
> >
> >
> > Thanks,
> > Paul
> >
> >
> >
> >
> >
> > *From:*Ian Turton <ijturton at gmail.com>
> > *Sent:* 27 November 2020 09:59
> > *To:* Paul Wittle <P.Wittle at dorsetcc.gov.uk>
> > *Cc:* qgis-developer at lists.osgeo.org
> > *Subject:* Re: [QGIS-Developer] Loading WFS layers from GeoServer
> >
> >
> >
> >
> >
> >
> >
> > On Fri, 27 Nov 2020 at 09:48, Paul Wittle <
> paul.wittle at dorsetcouncil.gov.uk <mailto:paul.wittle at dorsetcouncil.gov.uk>>
> wrote:
> >
> >     Hi,
> >
> >
> >
> >     I’m trying to load some WFS layers from my internal GeoServer into
> QGIS 3.10 and 3.16. The datastore in GeoServer is based on a view in a SQL
> Server database but it does have a primary key on the spatial table at
> least.
> >
> >
> >
> >     When I load it in 3.10 it comes in as the image icon (i.e. doesn’t
> load) so I thought I’d try it in the latest version and in that version
> QGIS just disappears (completely crashes).
> >
> >
> >
> >     Has anyone else had a similar problem and can help me work out how
> to get the layers to load? I suspect the issue is the way the view is
> configured in SQL Server however I also wonder if I need to investigate the
> 3.16 crash and potentially log that as a bug as it is not handling the
> crash with the normal message the application just closes without warning?
> >
> >
> >
> >
> >
> > Can you check if GeoServer is returning GML or an error message when you
> make a WFS request? But I don't think that QGis should crash no matter what
> is in the response.
> >
> >
> >
> > Ian
> >
> >
> >
> > This e-mail and any files transmitted with it are intended solely for
> > the use of the individual or entity to whom they are addressed. It may
> > contain unclassified but sensitive or protectively marked material and
> > should be handled accordingly. Unless you are the named addressee (or
> > authorised to receive it for the addressee) you may not copy or use
> > it, or disclose it to anyone else. If you have received this
> > transmission in error please notify the sender immediately. All
> > traffic may be subject to recording and/or monitoring in accordance
> > with relevant legislation. Any views expressed in this message are
> > those of the individual sender, except where the sender specifies and
> > with authority, states them to be the views of Dorset Council. Dorset
> > Council does not accept service of documents by fax or other
> > electronic means. Virus checking: Whilst all reasonable steps have
> > been taken to ensure that this electronic communication and its
> > attachments whether encoded, encrypted or otherwise supplied are free
> > from computer viruses, Dorset Council accepts no liability in respect
> > of any loss, cost, damage or expense suffered as a result of accessing
> > this message or any of its attachments. For information on how Dorset
> > Council processes your information, please see
> > www.dorsetcouncil.gov.uk/416433
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
>
> This e-mail and any files transmitted with it are intended solely for the
> use of the individual or entity to whom they are addressed. It may contain
> unclassified but sensitive or protectively marked material and should be
> handled accordingly. Unless you are the named addressee (or authorised to
> receive it for the addressee) you may not copy or use it, or disclose it to
> anyone else. If you have received this transmission in error please notify
> the sender immediately. All traffic may be subject to recording and/or
> monitoring in accordance with relevant legislation. Any views expressed in
> this message are those of the individual sender, except where the sender
> specifies and with authority, states them to be the views of Dorset
> Council. Dorset Council does not accept service of documents by fax or
> other electronic means. Virus checking: Whilst all reasonable steps have
> been taken to ensure that this electronic communication and its attachments
> whether encoded, encrypted or otherwise supplied are free from computer
> viruses, Dorset Council accepts no liability in respect of any loss, cost,
> damage or expense suffered as a result of accessing this message or any of
> its attachments. For information on how Dorset Council processes your
> information, please see www.dorsetcouncil.gov.uk/416433
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 
Ian Turton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201127/070cff56/attachment.html>


More information about the QGIS-Developer mailing list