Opened 9 years ago

Closed 9 years ago

Last modified 9 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:
Cc:

Description

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:'http://wfs.data.linz.govt.nz/59f2aaa148bd4818994fa0d3ca36f7e1/v/x1211/wfs'

<pre>
ERROR 1: Server is read-only WFS; no WFS-T feature advertized
Had to open data source read-only.
INFO: Open of `wfs:http://wfs.data.linz.govt.nz/59f2aaa148bd4818994fa0d3ca36f7e1/v/x1211/wfs'
      using driver `WFS' successful.

Layer name: v:x1211
Geometry: Unknown (any)
Feature Count: 77
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
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="http://www.opengis.net/gml/3.2" xmlns:v="http://wfs.data.linz.govt.nz" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://wfs.data.linz.govt.nz">
<xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://wfs.data.linz.govt.nz/schemas/gml/3.2.1/gml.xsd"/>
<xsd:complexType name="x1211Type">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<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:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="x1211" substitutionGroup="gml:AbstractFeature" type="v:x1211Type"/>
</xsd:schema>

Change History (5)

comment:1 by Jukka Rahkonen, 9 years ago

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" ?>
<ogr:FeatureCollection
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://ogr.maptools.org/ no_geom.xsd"
     xmlns:ogr="http://ogr.maptools.org/"
     xmlns:gml="http://www.opengis.net/gml">
  <gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
  <gml:featureMember>
    <ogr:no_geom fid="no_geom.0">
      <ogr:make>ACME</ogr:make>
      <ogr:model>Coyote</ogr:model>
      <ogr:cylinders>4</ogr:cylinders>
    </ogr:no_geom>
  </gml:featureMember>
</ogr:FeatureCollection>
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:
(unknown)
fid: String (0.0)
make: String (0.0)
model: String (0.0)
cylinders: String (0.0)

comment:2 by Even Rouault, 9 years ago

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 by jpalmer, 9 years ago

Thanks Even!

comment:4 by Jukka Rahkonen, 9 years ago

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.

http://wfs.data.linz.govt.nz/59f2aaa148bd4818994fa0d3ca36f7e1/v/x1211/wfs?service=wfs&version=1.1.0&request=getcapabilities

<ows:Keywords>
<ows:Keyword>New Zealand</ows:Keyword>
<ows:Keyword>Roads and Addresses</ows:Keyword>
<ows:Keyword>Street and Places Index</ows:Keyword>
</ows:Keywords>
<DefaultSRS>urn:ogc:def:crs:EPSG::4326</DefaultSRS>
<ows:WGS84BoundingBox>
<ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>
<ows:UpperCorner>180.0 90.0</ows:UpperCorner>
</ows:WGS84BoundingBox>

I am not sure but I believe that GetCapabilities is actually wrong. If I can read http://schemas.opengis.net/wfs/1.1.0/wfs.xsd 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 http://jira.codehaus.org/browse/GEOS-3233.

comment:5 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.