Opened 10 years ago

Closed 10 years ago

#5476 closed defect (worksforme)

OGR2OGR choosing incorrect datatype

Reported by: adcgis Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords: ogr2ogr
Cc:

Description (last modified by adcgis)

When using OGR2OGR to connect to WFS service pulling down GML, an incorrect data type is chosen. Chooses integer when should be string.

I understand that this has been an issue in the past, due to data sampling levels, maybe this needs to be adjusted again....

OGR is being utilised as part of MS4W 3.0.6

Using Linz data service, connecting direct from GIS system shows and downloads correct data type.

Connection string is as follows for testing purposes.

Variables populated in system WFS_SRS=EPSG:4167 NZTM_SRS=EPSG:2193 BBOX=-44.209572,170.607051,-43.189952,172.220523

Linz WFS layer that comes down incorrectly is Title,x804 Field that is incorrect is title_no

"%OGR_HOME%\ogr2ogr.exe" -s_srs %WFS_SRS% -t_srs %WFS_SRS% -a_srs %WFS_SRS% -f "GML" "%DEST%\gml\%%A.gml" "WFS:http://wfs.data.linz.govt.nz/%LDS_KEY%/v/%%B/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=v:%%B&bbox=%BBOX%&SRSNAME=%WFS_SRS%" -skipfailures

XSD file that is created by OGR2OGR is attached

Attachments (1)

Title.xsd (4.0 KB ) - added by adcgis 10 years ago.

Download all attachments as: .zip

Change History (5)

by adcgis, 10 years ago

Attachment: Title.xsd added

comment:1 by adcgis, 10 years ago

Description: modified (diff)

comment:2 by Even Rouault, 10 years ago

The XSD created by the GML driver is not relevant for the analysis (it is generated by the output side of ogr2ogr, not the input side). The one that would be interesting is the one returned by the DescribeFeatureType WFS request. It is likely that there's someone in it that the GML XSD parser cannot handle.

comment:3 by adcgis, 10 years ago

Thanks for your information, I have included the result from DescribeFeatureType below. It looks to me like there's nothing out of place, but you guys are the experts. Feel free to join the service it is free https://data.linz.govt.nz


query used in web browser I have removed my key ... join to get your own api key.

http://data.linz.govt.nz/services;key=************/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=data.linz.govt.nz:layer-804&SRSNAME=EPSG:4167


<?xml version="1.0" encoding="UTF-8"?>

-<xsd:schema targetNamespace="http://data.linz.govt.nz" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:data.linz.govt.nz="http://data.linz.govt.nz">

<xsd:import schemaLocation="http://data.linz.govt.nz/services;key=********/schemas/gml/3.1.1/base/gml.xsd" namespace="http://www.opengis.net/gml"/>

-<xsd:complexType name="layer-804Type">

-<xsd:complexContent>

-<xsd:extension base="gml:AbstractFeatureType">

-<xsd:sequence>

<xsd:element name="id" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="title_no" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="status" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="type" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="land_district" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="issue_date" type="xsd:dateTime" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="guarantee_status" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="estate_description" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="number_owners" type="xsd:long" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="spatial_extents_shared" type="xsd:boolean" nillable="true" minOccurs="0" maxOccurs="1"/>

<xsd:element name="shape" type="gml:MultiSurfacePropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>

</xsd:sequence>

</xsd:extension>

</xsd:complexContent>

</xsd:complexType>

<xsd:element name="layer-804" type="data.linz.govt.nz:layer-804Type" substitutionGroup="gml:_Feature"/>

</xsd:schema>

comment:4 by Even Rouault, 10 years ago

Resolution: worksforme
Status: newclosed

Ok I've just tried and it works fine with GDAL/OGR 1.11.

The following past commits have fixed the issue, and are likely not yet in the GDAL/OGR version provided by MS4W

------------------------------------------------------------------------
r26940 | rouault | 2014-02-13 22:58:27 +0100 (jeu. 13 févr. 2014) | 1 ligne

GML: recognize xsd:boolean in XSD parsing and map it to String (#5384)
------------------------------------------------------------------------
r23748 | rouault | 2012-01-13 00:34:27 +0100 (ven. 13 janv. 2012) | 1 ligne

GML .xsd parser: recognize type='dateType' as a string for now (#4439)
Note: See TracTickets for help on using tickets.