Skip to content

Commit

Permalink
Merge pull request OSGeo#5387 from rouault/fix_3882
Browse files Browse the repository at this point in the history
GeoJSON: report OFSTJSON subfield type for properties we can't map to…
  • Loading branch information
rouault authored Feb 25, 2022
2 parents 641de0c + 3be9cc8 commit 33bbd9e
Show file tree
Hide file tree
Showing 7 changed files with 763 additions and 73 deletions.
50 changes: 49 additions & 1 deletion autotest/ogr/data/geojson/test_type_promotion.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"bool_then_int64list": true,
"bool_then_reallist": true,
"bool_then_stringlist": true,
"bool_then_empty_array": true,
"bool_then_obj": true,

"int_then_bool": 1,
"int_then_int": 1,
Expand All @@ -26,6 +28,7 @@
"int_then_int64list": 1,
"int_then_reallist": 1,
"int_then_stringlist": 1,
"int_then_obj": 1,

"int64_then_bool": 1234567890123,
"int64_then_int": 1234567890123,
Expand All @@ -37,6 +40,7 @@
"int64_then_int64list": 1234567890123,
"int64_then_reallist": 1234567890123,
"int64_then_stringlist": 1234567890123,
"int64_then_obj": 1234567890123,

"real_then_bool": 0.015625,
"real_then_int": 0.015625,
Expand All @@ -48,6 +52,7 @@
"real_then_int64list": 0.015625,
"real_then_reallist": 0.015625,
"real_then_stringlist": 0.015625,
"real_then_obj": 0.015625,

"string_then_bool": "x",
"string_then_int": "x",
Expand All @@ -60,9 +65,11 @@
"string_then_reallist": "x",
"string_then_stringlist": "x",
"string_then_datetime": "x",
"string_then_obj": "x",

"datetime_then_string": "1970-01-01T00:00:00",
"datetime_then_datetime": "1970-01-01T00:00:00",
"datetime_then_obj": "1970-01-01T00:00:00",

"boollist_then_bool": [true],
"boollist_then_int": [true],
Expand All @@ -74,6 +81,7 @@
"boollist_then_int64list": [true],
"boollist_then_reallist": [true],
"boollist_then_stringlist": [true],
"boollist_then_obj": [true],

"intlist_then_bool": [1],
"intlist_then_int": [1],
Expand All @@ -85,6 +93,7 @@
"intlist_then_int64list": [1],
"intlist_then_reallist": [1],
"intlist_then_stringlist": [1],
"intlist_then_obj": [1],

"int64list_then_bool": [1234567890123],
"int64list_then_int": [1234567890123],
Expand All @@ -96,6 +105,7 @@
"int64list_then_int64list": [1234567890123],
"int64list_then_reallist": [1234567890123],
"int64list_then_stringlist": [1234567890123],
"int64list_then_obj": [1234567890123],

"reallist_then_bool": [0.015625],
"reallist_then_int": [0.015625],
Expand All @@ -107,6 +117,7 @@
"reallist_then_int64list": [0.015625],
"reallist_then_reallist": [0.015625],
"reallist_then_stringlist": [0.015625],
"reallist_then_obj": [0.015625],

"stringlist_then_bool": ["x"],
"stringlist_then_int": ["x"],
Expand All @@ -117,7 +128,30 @@
"stringlist_then_intlist": ["x"],
"stringlist_then_int64list": ["x"],
"stringlist_then_reallist": ["x"],
"stringlist_then_stringlist": ["x"]
"stringlist_then_stringlist": ["x"],
"stringlist_then_obj": ["x"],

"obj": {},

"mixed_array_str_int": [ "1", 2 ],
"mixed_array_int_str": [ 1, "2" ],
"mixed_array_int_array": [ 1, [] ],
"mixed_array_int_obj": [ 1, {} ],
"mixed_array_real_str": [ 1.5, "2" ],
"mixed_array_int_bool": [ 1, true ],
"mixed_array_bool_int": [ true, 1 ],
"mixed_array_int64_str": [ 1234567890123, "1" ],
"array_bool_bool": [ true, false ],
"array_int_int": [ 1, 2 ],
"array_int_int64": [ 1, 1234567890123 ],
"array_int_double": [ 1, 2.5 ],
"array_int64_int": [ 1234567890123, 1 ],
"array_int64_int64": [ 1234567890123, 1234567890123 ],
"array_int64_double": [ 1234567890123, 2.5 ],
"array_double_int": [ 1.5, 2 ],
"array_double_int64": [ 1.5, 1234567890123 ],
"array_double_double": [ 1.5, 2.5 ],
"array_string" : [ "a", "b" ]
}
},
{
Expand All @@ -134,6 +168,8 @@
"bool_then_int64list": [1234567890123],
"bool_then_reallist": [0.015625],
"bool_then_stringlist": ["x"],
"bool_then_empty_array": [],
"bool_then_obj": {},

"int_then_bool": true,
"int_then_int": 1,
Expand All @@ -145,6 +181,7 @@
"int_then_int64list": [1234567890123],
"int_then_reallist": [0.015625],
"int_then_stringlist": ["x"],
"int_then_obj": {},

"int64_then_bool": true,
"int64_then_int": 1,
Expand All @@ -156,6 +193,7 @@
"int64_then_int64list": [1234567890123],
"int64_then_reallist": [0.015625],
"int64_then_stringlist": ["x"],
"int64_then_obj": {},

"real_then_bool": true,
"real_then_int": 1,
Expand All @@ -167,6 +205,7 @@
"real_then_int64list": [1234567890123],
"real_then_reallist": [0.015625],
"real_then_stringlist": ["x"],
"real_then_obj": {},

"string_then_bool": true,
"string_then_int": 1,
Expand All @@ -179,9 +218,11 @@
"string_then_reallist": [0.015625],
"string_then_stringlist": ["x"],
"string_then_datetime": "1970-01-01T00:00:00",
"string_then_obj": {},

"datetime_then_string": "x",
"datetime_then_datetime": "1970-01-01T00:00:00",
"datetime_then_obj": {},

"boollist_then_bool": true,
"boollist_then_int": 1,
Expand All @@ -193,6 +234,7 @@
"boollist_then_int64list": [1234567890123],
"boollist_then_reallist": [0.015625],
"boollist_then_stringlist": ["x"],
"boollist_then_obj": {},

"intlist_then_bool": true,
"intlist_then_int": 1,
Expand All @@ -204,6 +246,7 @@
"intlist_then_int64list": [1234567890123],
"intlist_then_reallist": [0.015625],
"intlist_then_stringlist": ["x"],
"intlist_then_obj": {},

"int64list_then_bool": true,
"int64list_then_int": 1,
Expand All @@ -215,6 +258,7 @@
"int64list_then_int64list": [1234567890123],
"int64list_then_reallist": [0.015625],
"int64list_then_stringlist": ["x"],
"int64list_then_obj": {},

"reallist_then_bool": true,
"reallist_then_int": 1,
Expand All @@ -226,6 +270,7 @@
"reallist_then_int64list": [1234567890123],
"reallist_then_reallist": [0.015625],
"reallist_then_stringlist": ["x"],
"reallist_then_obj": {},

"stringlist_then_bool": true,
"stringlist_then_int": 1,
Expand All @@ -237,6 +282,9 @@
"stringlist_then_int64list": [1234567890123],
"stringlist_then_reallist": [0.015625],
"stringlist_then_stringlist": ["x"],
"stringlist_then_obj": {},

"obj": {"foo": 5}
}
}
]
Expand Down
Loading

0 comments on commit 33bbd9e

Please sign in to comment.