Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#5834 closed defect (fixed)

WFS Driver is not correctly setting Geometry Type

Reported by: jpalmer Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: default Version: svn-trunk
Severity: normal Keywords:


WFS Driver is not correctly setting Geometry Type to WkbNone? for featureTypes without a geometry column. Currently it sets the type as WkbUnknown?.

In the example below the WFS featuretype does not contain a geometry column, yet it's setting the geometry type to WkbUnknown? and assigning a coordinate system:

ogrinfo -so -al wfs:''

ERROR 1: Server is read-only WFS; no WFS-T feature advertized
Had to open data source read-only.
INFO: Open of `wfs:'
      using driver `WFS' successful.

Layer name: v:x1211
Geometry: Unknown (any)
Feature Count: 77
Layer SRS WKT:
        SPHEROID["WGS 84",6378137,298.257223563,
gml_id: String (0.0) NOT NULL
code: String (0.0)
name: String (0.0)
processing_centre: String (0.0)
abbreviation: String (0.0)
modified: String (0.0)
id: Integer (0.0)

If you look at the schema for the featuretype you can see there are no attributes with a GML geometry type.

<xsd:schema xmlns:gml="" xmlns:v="" xmlns:wfs="" xmlns:xsd="" elementFormDefault="qualified" targetNamespace="">
<xsd:import namespace="" schemaLocation=""/>
<xsd:complexType name="x1211Type">
<xsd:extension base="gml:AbstractFeatureType">
<xsd:element maxOccurs="1" minOccurs="0" name="code" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="processing_centre" nillable="true" type="xsd:short"/>
<xsd:element maxOccurs="1" minOccurs="0" name="abbreviation" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="modified" nillable="true" type="xsd:dateTime"/>
<xsd:element maxOccurs="1" minOccurs="0" name="id" nillable="true" type="xsd:int"/>
<xsd:element name="x1211" substitutionGroup="gml:AbstractFeature" type="v:x1211Type"/>

Change History (5)

comment:1 Changed 7 years ago by Jukka Rahkonen

Here is a minimal GML file that is created by ogr2ogr from a CSV file which proofs that GDAL can handle GML that lacks geometry attribute and this issue is special for WFS.

<?xml version="1.0" encoding="utf-8" ?>
     xsi:schemaLocation=" no_geom.xsd"
    <ogr:no_geom fid="no_geom.0">
ogrinfo no_geom.gml -al -so
Had to open data source read-only.
INFO: Open of `no_geom.gml'
      using driver `GML' successful.

Layer name: no_geom
Geometry: None
Feature Count: 1
Layer SRS WKT:
fid: String (0.0)
make: String (0.0)
model: String (0.0)
cylinders: String (0.0)

comment:2 Changed 7 years ago by Even Rouault

Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r28442 "WFS: when parsing a layer schema without geometry from the GML .xsd, do not expose a geometry field at the WFS layer level (#5834)"

comment:3 Changed 7 years ago by jpalmer

Thanks Even!

comment:4 Changed 7 years ago by Jukka Rahkonen

Note that the service does still advertize in the GetCapabilities? that the geometryless feature type covers the whole world in EPSG:4326. I wouldn't be surprised if many other clients will have some troubles with this feature type.

<ows:Keyword>New Zealand</ows:Keyword>
<ows:Keyword>Roads and Addresses</ows:Keyword>
<ows:Keyword>Street and Places Index</ows:Keyword>
<ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>
<ows:UpperCorner>180.0 90.0</ows:UpperCorner>

I am not sure but I believe that GetCapabilities? is actually wrong. If I can read is says that there should be either DefaultSRS and WGS84BoiundingBox or <xsd:element name="NoSRS">.

There may a connection with this issue in the Geoserver Jira

comment:5 Changed 6 years ago by Even Rouault


Milestone renamed

Note: See TracTickets for help on using tickets.