diff --git a/ogr/ogrsf_frmts/gmlas/ogr_gmlas.h b/ogr/ogrsf_frmts/gmlas/ogr_gmlas.h index 1425847331..2ac08caa6b 100644 --- a/ogr/ogrsf_frmts/gmlas/ogr_gmlas.h +++ b/ogr/ogrsf_frmts/gmlas/ogr_gmlas.h @@ -533,6 +533,7 @@ typedef enum GMLAS_FT_DECIMAL, GMLAS_FT_DATE, GMLAS_FT_GYEAR, + GMLAS_FT_GYEAR_MONTH, GMLAS_FT_TIME, GMLAS_FT_DATETIME, GMLAS_FT_BASE64BINARY, diff --git a/ogr/ogrsf_frmts/gmlas/ogr_gmlas_consts.h b/ogr/ogrsf_frmts/gmlas/ogr_gmlas_consts.h index 30d89df30c..3d3f6599ad 100644 --- a/ogr/ogrsf_frmts/gmlas/ogr_gmlas_consts.h +++ b/ogr/ogrsf_frmts/gmlas/ogr_gmlas_consts.h @@ -291,6 +291,7 @@ namespace GMLASConstants STRING_CONST(szXS_DECIMAL, "decimal"); STRING_CONST(szXS_DATE, "date"); STRING_CONST(szXS_GYEAR, "gYear"); + STRING_CONST(szXS_GYEAR_MONTH, "gYearMonth"); STRING_CONST(szXS_TIME, "time"); STRING_CONST(szXS_DATETIME, "dateTime"); STRING_CONST(szXS_ANY_URI, "anyURI"); diff --git a/ogr/ogrsf_frmts/gmlas/ogrgmlasfeatureclass.cpp b/ogr/ogrsf_frmts/gmlas/ogrgmlasfeatureclass.cpp index 87004006fb..a2f616b362 100644 --- a/ogr/ogrsf_frmts/gmlas/ogrgmlasfeatureclass.cpp +++ b/ogr/ogrsf_frmts/gmlas/ogrgmlasfeatureclass.cpp @@ -101,6 +101,8 @@ GMLASFieldType GMLASField::GetTypeFromString( const CPLString& osType ) return GMLAS_FT_DATE; else if( osType == szXS_GYEAR ) return GMLAS_FT_GYEAR; + else if( osType == szXS_GYEAR_MONTH ) + return GMLAS_FT_GYEAR_MONTH; else if( osType == szXS_TIME ) return GMLAS_FT_TIME; else if( osType == szXS_DATETIME ) diff --git a/ogr/ogrsf_frmts/gmlas/ogrgmlaslayer.cpp b/ogr/ogrsf_frmts/gmlas/ogrgmlaslayer.cpp index 98ba608cf9..8c4c6856d8 100644 --- a/ogr/ogrsf_frmts/gmlas/ogrgmlaslayer.cpp +++ b/ogr/ogrsf_frmts/gmlas/ogrgmlaslayer.cpp @@ -810,6 +810,9 @@ void OGRGMLASLayer::PostInit( bool bIncludeGeometryXML ) case GMLAS_FT_GYEAR: eType = OFTInteger; break; + case GMLAS_FT_GYEAR_MONTH: + eType = OFTDate; + break; case GMLAS_FT_TIME: eType = OFTTime; break; diff --git a/ogr/ogrsf_frmts/gmlas/ogrgmlasreader.cpp b/ogr/ogrsf_frmts/gmlas/ogrgmlasreader.cpp index 48bac0791d..99fbdf31a1 100644 --- a/ogr/ogrsf_frmts/gmlas/ogrgmlasreader.cpp +++ b/ogr/ogrsf_frmts/gmlas/ogrgmlasreader.cpp @@ -680,7 +680,7 @@ void GMLASReader::SetField( OGRFeature* poFeature, poFeature->SetField( nAttrIdx, "" ); } } - else if( eType == OFTDateTime ) + else if( eType == OFTDate || eType == OFTDateTime ) { OGRField sField; if( OGRParseXMLDateTime( diff --git a/ogr/ogrutils.cpp b/ogr/ogrutils.cpp index 5872631ef5..f6b9785340 100644 --- a/ogr/ogrutils.cpp +++ b/ogr/ogrutils.cpp @@ -1233,6 +1233,14 @@ int OGRParseXMLDateTime( const char* pszXMLDateTime, TZ = 0; bRet = true; } + // Date is expressed as a UTC date with only year:month. + else if( sscanf(pszXMLDateTime, "%04d-%02d", &year, &month) == + 2 ) + { + TZ = 0; + bRet = true; + day = 1; + } if( !bRet ) return FALSE;