Skip to content

Commit

Permalink
GMLAS: take into account gYearMonth XML data type (relates to BRGM/gm…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 5, 2017
1 parent a6da4ab commit d9328eb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions ogr/ogrsf_frmts/gmlas/ogr_gmlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions ogr/ogrsf_frmts/gmlas/ogr_gmlas_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions ogr/ogrsf_frmts/gmlas/ogrgmlasfeatureclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/gmlas/ogrgmlaslayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ogr/ogrsf_frmts/gmlas/ogrgmlasreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions ogr/ogrutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d9328eb

Please sign in to comment.