Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5384 closed defect (fixed)

WFS: Last field not returned is first field value is null

Reported by: jpalmer Owned by: warmerdam
Priority: normal Milestone: 1.10.2
Component: default Version: unspecified
Severity: normal Keywords: WFS GML
Cc: Even Rouault

Description

It seems the ogr driver does not output the last field from the service if the field value is null for the first record.

I can provide example servers requests if required.

Change History (6)

comment:1 Changed 3 years ago by Even Rouault

Yes, that may be possible in the degenerated case where the feature schema obtained with a DescribeFeatureType? request is too complex to be understood by the OGR GML driver. Then the WFS driver will request the first feature to try deducing a schema. And the GML driver will ignore a null field when building the schema. Well, that's just a guess of what my happen in your case. Perhaps you can provide indeed an example server.

comment:2 Changed 3 years ago by jpalmer

Example:

ogrinfo -so WFS:"http://wfs.data.linz.govt.nz/b39ccd76408f48d9bcbbcc4817432518/v/x1695/wfs?MAXFEATURES=3" v:x1695

encumbrancees field gets missed. I've also the DescribeFeatureType? response is:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:v="http://data.linz.govt.nz/ns/v" elementFormDefault="qualified" targetNamespace="http://data.linz.govt.nz/ns/v">
<xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://wfs.data.linz.govt.nz/3b7124f23806431c8371f139ec84c40e/schemas/gml/3.1.1/base/gml.xsd"/>
<xsd:complexType name="x1695Type">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="id" nillable="true" type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="0" name="title_no" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="land_district" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="memorial_text" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="current" nillable="true" type="xsd:boolean"/>
<xsd:element maxOccurs="1" minOccurs="0" name="instrument_number" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="instrument_lodged_datetime" nillable="true" type="xsd:dateTime"/>
<xsd:element maxOccurs="1" minOccurs="0" name="instrument_type" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="encumbrancees" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="x1695" substitutionGroup="gml:_Feature" type="v:x1695Type"/>
</xsd:schema>

comment:3 Changed 3 years ago by jpalmer

Cc: Even Rouault added

Even I think your assumption must be correct because if you add "&CQL_FILTER=id=14" onto the end of the test URL, then the encumbrancees field shows up in ogrinfo

comment:4 Changed 3 years ago by Even Rouault

Keywords: GML added
Milestone: 1.11.01.10.2
Resolution: fixed
Status: newclosed

Fixed in trunk (r26940) and branches/1.10 (r26941) : "GML: recognize xsd:boolean in XSD parsing and map it to String (#5384)"

comment:5 Changed 3 years ago by jpalmer

Thanks Even!!

Tested and now working.

As a side note is there anyway to stop ogrinfo form issuing a full GETFEATURE request (resultType=hit requests are ok)? This layer is very large and it takes a long time to fetch all of the data.

ogrinfo --debug ON -ro -so WFS:"http://wfs.data.linz.govt.nz/b39ccd76408f48d9bcbbcc4817432518/v/x1695/wfs" v:x1695

At the moment I add "?MAXFEATURES=1" onto the end of the URL to get it to return a fast result, but that's not ideal. Is it issuing this GETFEATURE request because it's a geometry less table, but the driver still wants to determine the geometry type?

Cheers Jeremy

comment:6 Changed 3 years ago by Even Rouault

The full scan is needed to retrieve the spatial extent of the layer, which is an information displayed by ogrinfo (there's a long standing discussion on whether we should display a reliable information, which needs the full scan, or whether we should just use the extent reported by GetCapabilities? that may be approximate)

Oh, I realize you mention it is a geomtry less table. Hum, well perhaps an optimization could be made in that case, but that's rather a marginal use case of WFS.

Note: See TracTickets for help on using tickets.