I have a question regarding ogr2ogr's auto-conversion of text fields to date fields, specifically in the case of additional text following the date.
input.geojson file:
{
"type": "FeatureCollection",
"name": "abc",
"features": [
{
"type": "Feature",
"properties": {
"Notes": "2022/05/12 blah blah blah"
},
"geometry": {
"type": "Point",
"coordinates": [
-76,
39
]
}
}
]
}
After running: ogr2ogr output.geojson input.geojson
, I get the warning:
Warning 1: The output driver does not natively support Date type for field Notes. Misconversion can happen. -mapFieldType can be used to control field type conversion.
When I run the above again but with the options -mapFieldType Date=String
or -mapFieldType All=String
, the warning disappears. However, in all three cases, my output.geojson file reads:
{
"type": "FeatureCollection",
"name": "abc",
"features": [
{
"type": "Feature",
"properties": { "Notes": "2022/05/12" },
"geometry": { "type": "Point", "coordinates": [-76.0, 39.0] }
}
]
}
As you can see, the Notes property is stripped of its text, leaving only the date.
Is there is not an option in ogr2ogr to preserve the content of Notes, what are the rules that govern ogr2ogr's auto-conversion of types so that I can better understand this behavior?