aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/iso19111/io.cpp27
-rw-r--r--src/wkt1_generated_parser.c357
-rw-r--r--src/wkt1_grammar.y17
-rw-r--r--test/unit/test_io.cpp32
4 files changed, 252 insertions, 181 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 0f4ffba0..503b6be5 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -6507,6 +6507,33 @@ BaseObjectNNPtr WKTParser::createFromWKT(const std::string &wkt) {
}
return d->buildGeodeticReferenceFrame(root, primeMeridian,
null_node);
+ } else if (ci_equal(name, WKTConstants::GEOGCS) ||
+ ci_equal(name, WKTConstants::PROJCS)) {
+ // Parse implicit compoundCRS from ESRI that is
+ // "PROJCS[...],VERTCS[...]" or "GEOGCS[...],VERTCS[...]"
+ if (indexEnd < wkt.size()) {
+ indexEnd = skipSpace(wkt, indexEnd);
+ if (indexEnd < wkt.size() && wkt[indexEnd] == ',') {
+ ++indexEnd;
+ indexEnd = skipSpace(wkt, indexEnd);
+ if (indexEnd < wkt.size() &&
+ ci_starts_with(wkt.c_str() + indexEnd,
+ WKTConstants::VERTCS.c_str())) {
+ auto horizCRS = d->buildCRS(root);
+ if (horizCRS) {
+ auto vertCRS =
+ d->buildVerticalCRS(WKTNode::createFrom(
+ wkt, indexEnd, 0, indexEnd));
+ return CompoundCRS::create(
+ util::PropertyMap().set(
+ IdentifiedObject::NAME_KEY,
+ horizCRS->nameStr() + " + " +
+ vertCRS->nameStr()),
+ {NN_NO_CHECK(horizCRS), vertCRS});
+ }
+ }
+ }
+ }
}
return d->build(root);
};
diff --git a/src/wkt1_generated_parser.c b/src/wkt1_generated_parser.c
index 2785ec9f..0934ae9d 100644
--- a/src/wkt1_generated_parser.c
+++ b/src/wkt1_generated_parser.c
@@ -422,18 +422,18 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 30
+#define YYFINAL 32
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 222
+#define YYLAST 227
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 36
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 67
+#define YYNNTS 69
/* YYNRULES -- Number of rules. */
-#define YYNRULES 101
+#define YYNRULES 105
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 267
+#define YYNSTATES 272
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
@@ -484,15 +484,15 @@ static const yytype_uint16 yyrline[] =
{
0, 80, 80, 92, 92, 95, 98, 98, 101, 101,
101, 101, 104, 107, 109, 110, 113, 115, 116, 119,
- 122, 126, 131, 131, 131, 131, 131, 131, 134, 134,
- 138, 142, 143, 146, 147, 149, 150, 151, 152, 154,
- 155, 158, 161, 164, 168, 170, 171, 172, 173, 176,
- 180, 183, 186, 189, 192, 195, 198, 201, 204, 207,
- 208, 209, 210, 213, 216, 219, 220, 222, 223, 224,
- 227, 230, 232, 233, 234, 237, 240, 243, 246, 248,
- 251, 256, 259, 261, 264, 267, 270, 273, 276, 279,
- 282, 285, 288, 291, 294, 297, 300, 302, 304, 305,
- 306, 309
+ 122, 126, 131, 131, 131, 131, 131, 131, 134, 135,
+ 138, 138, 142, 146, 147, 150, 151, 153, 154, 155,
+ 156, 158, 159, 162, 165, 168, 172, 174, 175, 176,
+ 177, 180, 184, 187, 190, 193, 196, 199, 202, 205,
+ 208, 211, 212, 213, 214, 217, 220, 223, 224, 227,
+ 229, 230, 231, 234, 237, 239, 240, 241, 244, 247,
+ 250, 255, 255, 257, 260, 265, 268, 270, 273, 276,
+ 279, 282, 285, 288, 291, 294, 297, 300, 303, 306,
+ 309, 311, 313, 314, 315, 318
};
#endif
@@ -512,15 +512,15 @@ static const char *const yytname[] =
"begin_node", "begin_node_name", "end_node", "math_transform",
"param_mt", "parameter", "opt_parameter_list", "concat_mt",
"opt_math_transform_list", "inv_mt", "passthrough_mt", "integer",
- "coordinate_system", "horz_cs", "projected_cs",
- "opt_parameter_list_linear_unit", "parameter_list_linear_unit",
- "opt_twin_axis_extension_authority", "opt_authority", "extension",
- "projection", "geographic_cs", "datum",
+ "coordinate_system", "horz_cs_with_opt_esri_vertcs", "horz_cs",
+ "projected_cs", "opt_parameter_list_linear_unit",
+ "parameter_list_linear_unit", "opt_twin_axis_extension_authority",
+ "opt_authority", "extension", "projection", "geographic_cs", "datum",
"opt_towgs84_authority_extension", "spheroid", "semi_major_axis",
"inverse_flattening", "prime_meridian", "longitude", "angular_unit",
"linear_unit", "unit", "conversion_factor", "geocentric_cs",
"opt_three_axis_extension_authority", "three_axis", "authority",
- "vert_cs", "opt_axis_authority", "vert_datum", "vdatum",
+ "vert_cs", "esri_vert_cs", "opt_axis_authority", "vert_datum", "vdatum",
"opt_extension_authority", "datum_type", "compd_cs", "head_cs",
"tail_cs", "twin_axis", "axis", "towgs84", "towgs84_parameters",
"three_parameters", "seven_parameters", "dx", "dy", "dz", "ex", "ey",
@@ -541,10 +541,10 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -127
+#define YYPACT_NINF -135
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-127)))
+ (!!((Yystate) == (-135)))
#define YYTABLE_NINF -1
@@ -555,33 +555,34 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- 125, 1, 1, 1, 1, 1, 1, 1, 1, 25,
- -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
- -127, 8, 9, 18, 28, 37, 46, 50, 51, 43,
- -127, -127, 61, 77, 77, 71, 74, 125, 132, -127,
- -127, 65, -127, 60, 1, 64, 66, 1, 67, 1,
- 69, -127, 70, 1, 1, 1, 1, -127, -127, -127,
- -127, -127, 72, 1, 76, 88, 83, 97, 97, 85,
- 99, 33, -7, 125, 86, 132, 132, 95, 125, 90,
- 99, 1, 91, 118, 1, 96, 108, 101, 1, 109,
- -127, -127, 1, 112, 33, -127, -127, -127, 115, 126,
- 33, 116, 33, -127, 119, -127, 33, 101, 120, 121,
- -7, 1, 122, 123, 99, 99, -127, 115, 124, -3,
- 33, 130, -7, -127, 0, 33, 86, -127, 132, 33,
- -127, 132, -127, 121, 139, 146, 33, 131, 133, -1,
- 33, 138, 131, -127, 134, 33, 141, 1, 1, -127,
- 121, -127, 142, -127, -127, 1, 121, -127, -127, -127,
- 116, -127, 33, 33, 137, -127, -127, 7, 33, 144,
- 1, 121, -127, 115, -127, -127, 121, 33, 7, 33,
- -127, -127, 121, 143, 145, -127, 33, 149, -127, -127,
- -127, -127, -3, 33, 121, -127, 115, 150, -127, -127,
- 151, 147, -127, -127, 33, -127, 121, 115, -127, 152,
- -127, 33, 153, 158, -127, 161, -127, 137, -127, -127,
- -127, 139, 148, -127, 33, -127, -127, 156, -127, -127,
- -127, 139, -127, 33, 33, 33, -127, -127, -127, 121,
- -127, 163, 159, -127, -127, -127, 33, -127, 160, 139,
- -127, 164, -127, -127, 162, 167, -127, 165, 169, -127,
- 166, 170, -127, 168, 173, -127, -127
+ 119, 10, 10, 10, 10, 10, 10, 10, 10, 29,
+ -135, -135, -22, -135, -135, -135, -135, -135, -135, -135,
+ -135, -135, -135, 3, -2, 0, 18, 19, 21, 43,
+ 47, 53, -135, 66, -135, 81, 86, 86, 79, 84,
+ 17, 116, -135, -135, 83, -135, -135, 69, 10, 78,
+ 80, 10, 82, 10, 90, -135, 92, 10, 10, 10,
+ 10, -135, -135, -135, -135, -135, 96, 10, 97, 106,
+ 102, 126, 126, 105, 131, 11, -1, 60, 110, 116,
+ 116, 117, 119, 112, 131, 10, 113, 138, 10, 115,
+ 118, 122, 10, 120, -135, -135, 10, 121, 11, -135,
+ -135, -135, -135, 123, 133, 11, 125, 11, -135, 127,
+ -135, 11, 122, 134, 135, -1, 10, 136, 137, 131,
+ 131, -135, 123, 140, -6, 11, 142, -1, -135, 13,
+ 11, 110, -135, 116, 11, -135, 116, -135, 135, 147,
+ 146, 11, 143, 144, 12, 11, 151, 143, -135, 148,
+ 11, 152, 10, 10, -135, 135, -135, 153, -135, -135,
+ 10, 135, -135, -135, -135, 125, -135, 11, 11, 149,
+ -135, -135, 58, 11, 156, 10, 135, -135, 123, -135,
+ -135, 135, 11, 58, 11, -135, -135, 135, 154, 155,
+ -135, 11, 157, -135, -135, -135, -135, -6, 11, 135,
+ -135, 123, 158, -135, -135, 159, 162, -135, -135, 11,
+ -135, 135, 123, -135, 160, -135, 11, 124, 166, -135,
+ 145, -135, 149, -135, -135, -135, 147, 168, -135, 11,
+ -135, -135, 163, -135, -135, -135, 147, -135, 11, 11,
+ 11, -135, -135, -135, 135, -135, 170, 165, -135, -135,
+ -135, 11, -135, 167, 147, -135, 172, -135, -135, 169,
+ 174, -135, 171, 176, -135, 173, 178, -135, 175, 180,
+ -135, -135
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -590,56 +591,57 @@ static const yytype_int16 yypact[] =
static const yytype_uint8 yydefact[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 22, 29, 28, 23, 24, 25, 26, 27, 3,
- 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 5, 0, 0, 0, 0, 0, 0, 0, 6,
- 7, 0, 97, 0, 0, 0, 0, 0, 0, 0,
- 0, 77, 0, 0, 0, 0, 0, 94, 8, 9,
- 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 14, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 67,
- 55, 71, 0, 0, 0, 32, 31, 78, 72, 0,
- 0, 17, 0, 21, 0, 95, 0, 0, 0, 39,
- 0, 0, 45, 0, 0, 0, 75, 72, 0, 0,
- 0, 0, 0, 66, 0, 0, 14, 12, 0, 0,
- 19, 0, 93, 39, 0, 0, 0, 35, 0, 0,
- 0, 0, 35, 54, 59, 0, 0, 0, 0, 69,
- 39, 65, 0, 33, 34, 0, 39, 74, 76, 15,
- 17, 16, 0, 0, 98, 40, 42, 0, 0, 0,
- 0, 39, 48, 72, 44, 53, 39, 0, 0, 0,
- 70, 57, 39, 0, 0, 68, 0, 0, 73, 18,
- 20, 101, 0, 0, 39, 38, 72, 0, 30, 50,
- 0, 0, 47, 46, 0, 43, 39, 72, 62, 0,
- 58, 0, 0, 0, 13, 0, 99, 98, 96, 37,
- 36, 0, 0, 86, 0, 83, 82, 0, 52, 61,
- 60, 0, 56, 0, 0, 0, 100, 79, 51, 39,
- 81, 0, 0, 64, 80, 41, 0, 87, 0, 0,
- 49, 0, 63, 88, 84, 0, 89, 0, 0, 90,
- 0, 0, 91, 0, 0, 92, 85
+ 2, 22, 28, 31, 30, 23, 24, 68, 25, 26,
+ 27, 3, 4, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 5, 0, 0, 0, 0, 0,
+ 0, 0, 6, 7, 0, 101, 29, 0, 0, 0,
+ 0, 0, 0, 0, 0, 80, 0, 0, 0, 0,
+ 0, 98, 8, 9, 10, 11, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 70, 57, 74, 0, 0, 0, 34,
+ 33, 81, 82, 75, 0, 0, 17, 0, 21, 0,
+ 99, 0, 0, 0, 41, 0, 0, 47, 0, 0,
+ 0, 78, 75, 0, 0, 0, 0, 0, 69, 0,
+ 0, 14, 12, 0, 0, 19, 0, 97, 41, 0,
+ 0, 0, 37, 0, 0, 0, 0, 37, 56, 61,
+ 0, 0, 0, 0, 72, 41, 67, 0, 35, 36,
+ 0, 41, 77, 79, 15, 17, 16, 0, 0, 102,
+ 42, 44, 0, 0, 0, 0, 41, 50, 75, 46,
+ 55, 41, 0, 0, 0, 73, 59, 41, 0, 0,
+ 71, 0, 0, 76, 18, 20, 105, 0, 0, 41,
+ 40, 75, 0, 32, 52, 0, 0, 49, 48, 0,
+ 45, 41, 75, 64, 0, 60, 0, 0, 0, 13,
+ 0, 103, 102, 100, 39, 38, 0, 0, 90, 0,
+ 87, 86, 0, 54, 63, 62, 0, 58, 0, 0,
+ 0, 104, 83, 53, 41, 85, 0, 0, 66, 84,
+ 43, 0, 91, 0, 0, 51, 0, 65, 92, 88,
+ 0, 93, 0, 0, 94, 0, 0, 95, 0, 0,
+ 96, 89
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -127, -127, -53, 35, -71, -67, -127, 75, 53, -127,
- 44, -127, -127, -127, -26, -127, -127, 98, 84, 63,
- -126, -64, -127, 175, 176, -127, -127, -127, -127, 154,
- -127, -127, -60, -63, -127, -127, -127, -127, -119, -127,
- -127, -127, -127, -113, 102, -127, -127, -127, -127, -121,
- -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
- -127, -127, -127, -127, -127, -6, -127
+ -135, -135, -57, 14, -75, -73, -135, 107, 55, -135,
+ 22, -135, -135, -135, 130, -135, 177, -135, 73, 87,
+ 68, -87, -134, -135, -31, 179, -135, -135, -135, -135,
+ 141, -135, -135, -63, -76, -135, -135, -135, -135, -92,
+ 150, 185, -135, -135, -135, -117, 108, -135, -135, -135,
+ -135, -125, -135, -135, -135, -135, -135, -135, -135, -135,
+ -135, -135, -135, -135, -135, -135, -135, -3, -135
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 9, 21, 22, 42, 57, 58, 93, 100, 59,
- 129, 60, 61, 104, 10, 11, 12, 94, 95, 168,
- 136, 156, 82, 13, 45, 140, 112, 200, 239, 85,
- 176, 142, 96, 90, 182, 14, 179, 207, 149, 15,
- 120, 48, 50, 125, 117, 16, 52, 98, 196, 150,
- 173, 224, 225, 226, 227, 248, 254, 257, 260, 263,
- 266, 17, 62, 106, 18, 193, 64
+ -1, 9, 23, 24, 45, 61, 62, 97, 105, 63,
+ 134, 64, 65, 109, 10, 11, 12, 13, 98, 99,
+ 173, 141, 161, 86, 14, 49, 145, 117, 205, 244,
+ 89, 181, 147, 100, 94, 187, 15, 184, 212, 154,
+ 16, 17, 125, 52, 54, 130, 122, 18, 56, 103,
+ 201, 155, 178, 229, 230, 231, 232, 253, 259, 262,
+ 265, 268, 271, 19, 66, 111, 20, 198, 68
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -647,56 +649,56 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint16 yytable[] =
{
- 91, 75, 76, 77, 145, 157, 88, 163, 101, 102,
- 89, 51, 147, 164, 147, 147, 165, 108, 148, 92,
- 172, 170, 147, 123, 185, 30, 155, 155, 148, 127,
- 188, 130, 19, 20, 155, 132, 31, 23, 24, 25,
- 26, 27, 28, 29, 32, 202, 197, 97, 195, 151,
- 204, 143, 105, 33, 158, 144, 211, 209, 161, 208,
- 203, 160, 154, 34, 162, 166, 39, 40, 219, 174,
- 2, 217, 35, 216, 180, 171, 39, 40, 41, 66,
- 229, 36, 69, 220, 71, 37, 38, 44, 74, 47,
- 63, 190, 191, 49, 230, 65, 81, 198, 79, 67,
- 237, 68, 70, 194, 72, 73, 205, 78, 210, 84,
- 242, 80, 88, 246, 206, 214, 109, 201, 83, 113,
- 87, 99, 218, 118, 103, 107, 110, 121, 252, 111,
- 116, 114, 1, 228, 2, 53, 54, 55, 56, 3,
- 232, 4, 5, 115, 119, 6, 138, 122, 7, 8,
- 124, 128, 92, 240, 131, 134, 135, 139, 141, 146,
- 148, 147, 243, 244, 245, 152, 167, 175, 169, 178,
- 181, 186, 192, 199, 126, 250, 223, 238, 212, 159,
- 213, 233, 183, 184, 215, 221, 222, 231, 234, 235,
- 187, 241, 247, 253, 249, 251, 256, 255, 259, 262,
- 258, 261, 265, 264, 189, 177, 153, 43, 137, 133,
- 46, 236, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 86
+ 95, 79, 80, 81, 47, 150, 106, 107, 113, 152,
+ 176, 93, 92, 33, 169, 153, 25, 26, 27, 28,
+ 29, 30, 31, 128, 1, 96, 2, 152, 152, 32,
+ 132, 34, 135, 35, 175, 36, 137, 162, 199, 160,
+ 160, 21, 22, 148, 42, 43, 101, 202, 170, 211,
+ 156, 168, 177, 37, 38, 163, 39, 149, 214, 166,
+ 165, 208, 70, 167, 159, 73, 171, 75, 190, 2,
+ 179, 78, 222, 152, 193, 185, 4, 5, 40, 153,
+ 200, 83, 41, 5, 225, 160, 42, 43, 44, 207,
+ 2, 213, 195, 196, 209, 235, 48, 51, 203, 114,
+ 216, 242, 118, 53, 69, 221, 123, 210, 67, 215,
+ 126, 247, 224, 71, 85, 72, 219, 74, 206, 57,
+ 58, 59, 60, 223, 234, 76, 1, 77, 2, 257,
+ 143, 82, 84, 3, 233, 4, 5, 87, 88, 6,
+ 91, 237, 7, 8, 92, 104, 108, 112, 115, 116,
+ 119, 121, 238, 120, 245, 124, 127, 251, 129, 96,
+ 133, 152, 136, 248, 249, 250, 188, 189, 153, 139,
+ 140, 144, 146, 240, 192, 151, 255, 157, 172, 174,
+ 180, 186, 191, 183, 197, 204, 164, 194, 142, 217,
+ 218, 228, 220, 226, 227, 236, 239, 243, 246, 252,
+ 254, 258, 256, 261, 260, 264, 263, 267, 266, 270,
+ 269, 131, 110, 90, 158, 182, 50, 55, 46, 241,
+ 138, 0, 0, 0, 0, 0, 0, 102
};
static const yytype_int16 yycheck[] =
{
- 71, 54, 55, 56, 117, 124, 13, 133, 75, 76,
- 70, 37, 15, 134, 15, 15, 135, 80, 21, 26,
- 139, 22, 15, 94, 150, 0, 27, 27, 21, 100,
- 156, 102, 31, 32, 27, 106, 28, 2, 3, 4,
- 5, 6, 7, 8, 35, 171, 167, 73, 167, 120,
- 176, 114, 78, 35, 125, 115, 182, 178, 129, 178,
- 173, 128, 122, 35, 131, 136, 33, 34, 194, 140,
- 9, 192, 35, 192, 145, 139, 33, 34, 35, 44,
- 206, 35, 47, 196, 49, 35, 35, 10, 53, 18,
- 25, 162, 163, 19, 207, 35, 8, 168, 63, 35,
- 221, 35, 35, 167, 35, 35, 177, 35, 179, 12,
- 231, 35, 13, 239, 178, 186, 81, 170, 35, 84,
- 35, 35, 193, 88, 29, 35, 35, 92, 249, 11,
- 29, 35, 7, 204, 9, 3, 4, 5, 6, 14,
- 211, 16, 17, 35, 35, 20, 111, 35, 23, 24,
- 35, 35, 26, 224, 35, 35, 35, 35, 35, 35,
- 21, 15, 233, 234, 235, 35, 35, 29, 35, 35,
- 29, 29, 35, 29, 99, 246, 29, 29, 35, 126,
- 35, 28, 147, 148, 35, 35, 35, 35, 30, 28,
- 155, 35, 29, 29, 35, 35, 29, 35, 29, 29,
- 35, 35, 29, 35, 160, 142, 122, 32, 110, 107,
- 34, 217, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 68
+ 75, 58, 59, 60, 35, 122, 79, 80, 84, 15,
+ 144, 74, 13, 35, 139, 21, 2, 3, 4, 5,
+ 6, 7, 8, 98, 7, 26, 9, 15, 15, 0,
+ 105, 28, 107, 35, 22, 35, 111, 129, 172, 27,
+ 27, 31, 32, 119, 33, 34, 77, 172, 140, 183,
+ 125, 138, 144, 35, 35, 130, 35, 120, 183, 134,
+ 133, 178, 48, 136, 127, 51, 141, 53, 155, 9,
+ 145, 57, 197, 15, 161, 150, 16, 17, 35, 21,
+ 172, 67, 35, 17, 201, 27, 33, 34, 35, 176,
+ 9, 183, 167, 168, 181, 212, 10, 18, 173, 85,
+ 187, 226, 88, 19, 35, 197, 92, 182, 25, 184,
+ 96, 236, 199, 35, 8, 35, 191, 35, 175, 3,
+ 4, 5, 6, 198, 211, 35, 7, 35, 9, 254,
+ 116, 35, 35, 14, 209, 16, 17, 35, 12, 20,
+ 35, 216, 23, 24, 13, 35, 29, 35, 35, 11,
+ 35, 29, 28, 35, 229, 35, 35, 244, 35, 26,
+ 35, 15, 35, 238, 239, 240, 152, 153, 21, 35,
+ 35, 35, 35, 28, 160, 35, 251, 35, 35, 35,
+ 29, 29, 29, 35, 35, 29, 131, 165, 115, 35,
+ 35, 29, 35, 35, 35, 35, 30, 29, 35, 29,
+ 35, 29, 35, 29, 35, 29, 35, 29, 35, 29,
+ 35, 104, 82, 72, 127, 147, 37, 40, 33, 222,
+ 112, -1, -1, -1, -1, -1, -1, 77
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -704,32 +706,33 @@ static const yytype_int16 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 7, 9, 14, 16, 17, 20, 23, 24, 37,
- 50, 51, 52, 59, 71, 75, 81, 97, 100, 31,
- 32, 38, 39, 39, 39, 39, 39, 39, 39, 39,
- 0, 28, 35, 35, 35, 35, 35, 35, 35, 33,
- 34, 35, 40, 59, 10, 60, 60, 18, 77, 19,
- 78, 50, 82, 3, 4, 5, 6, 41, 42, 45,
- 47, 48, 98, 25, 102, 35, 39, 35, 35, 39,
- 35, 39, 35, 35, 39, 38, 38, 38, 35, 39,
- 35, 8, 58, 35, 12, 65, 65, 35, 13, 68,
- 69, 40, 26, 43, 53, 54, 68, 50, 83, 35,
- 44, 41, 41, 29, 49, 50, 99, 35, 69, 39,
- 35, 11, 62, 39, 35, 35, 29, 80, 39, 35,
- 76, 39, 35, 40, 35, 79, 43, 40, 35, 46,
- 40, 35, 40, 80, 35, 35, 56, 53, 39, 35,
- 61, 35, 67, 69, 68, 79, 35, 15, 21, 74,
- 85, 40, 35, 54, 68, 27, 57, 74, 40, 44,
- 41, 40, 41, 56, 85, 74, 40, 35, 55, 35,
- 22, 57, 74, 86, 40, 29, 66, 55, 35, 72,
- 40, 29, 70, 39, 39, 56, 29, 39, 56, 46,
- 40, 40, 35, 101, 57, 74, 84, 85, 40, 29,
- 63, 38, 56, 79, 56, 40, 57, 73, 74, 85,
- 40, 56, 35, 35, 40, 35, 74, 85, 40, 56,
- 79, 35, 35, 29, 87, 88, 89, 90, 40, 56,
- 79, 35, 40, 28, 30, 28, 101, 85, 29, 64,
- 40, 35, 85, 40, 40, 40, 56, 29, 91, 35,
- 40, 35, 85, 29, 92, 35, 29, 93, 35, 29,
- 94, 35, 29, 95, 35, 29, 96
+ 50, 51, 52, 53, 60, 72, 76, 77, 83, 99,
+ 102, 31, 32, 38, 39, 39, 39, 39, 39, 39,
+ 39, 39, 0, 35, 28, 35, 35, 35, 35, 35,
+ 35, 35, 33, 34, 35, 40, 77, 60, 10, 61,
+ 61, 18, 79, 19, 80, 52, 84, 3, 4, 5,
+ 6, 41, 42, 45, 47, 48, 100, 25, 104, 35,
+ 39, 35, 35, 39, 35, 39, 35, 35, 39, 38,
+ 38, 38, 35, 39, 35, 8, 59, 35, 12, 66,
+ 66, 35, 13, 69, 70, 40, 26, 43, 54, 55,
+ 69, 60, 76, 85, 35, 44, 41, 41, 29, 49,
+ 50, 101, 35, 70, 39, 35, 11, 63, 39, 35,
+ 35, 29, 82, 39, 35, 78, 39, 35, 40, 35,
+ 81, 43, 40, 35, 46, 40, 35, 40, 82, 35,
+ 35, 57, 54, 39, 35, 62, 35, 68, 70, 69,
+ 81, 35, 15, 21, 75, 87, 40, 35, 55, 69,
+ 27, 58, 75, 40, 44, 41, 40, 41, 57, 87,
+ 75, 40, 35, 56, 35, 22, 58, 75, 88, 40,
+ 29, 67, 56, 35, 73, 40, 29, 71, 39, 39,
+ 57, 29, 39, 57, 46, 40, 40, 35, 103, 58,
+ 75, 86, 87, 40, 29, 64, 38, 57, 81, 57,
+ 40, 58, 74, 75, 87, 40, 57, 35, 35, 40,
+ 35, 75, 87, 40, 57, 81, 35, 35, 29, 89,
+ 90, 91, 92, 40, 57, 81, 35, 40, 28, 30,
+ 28, 103, 87, 29, 65, 40, 35, 87, 40, 40,
+ 40, 57, 29, 93, 35, 40, 35, 87, 29, 94,
+ 35, 29, 95, 35, 29, 96, 35, 29, 97, 35,
+ 29, 98
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
@@ -738,14 +741,14 @@ static const yytype_uint8 yyr1[] =
0, 36, 37, 38, 38, 39, 40, 40, 41, 41,
41, 41, 42, 43, 44, 44, 45, 46, 46, 47,
48, 49, 50, 50, 50, 50, 50, 50, 51, 51,
- 52, 53, 53, 54, 54, 55, 55, 55, 55, 56,
- 56, 57, 58, 59, 60, 61, 61, 61, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 72, 72, 72, 73, 74, 75, 75, 76, 76, 76,
- 77, 78, 79, 79, 79, 80, 81, 82, 83, 84,
- 85, 86, 87, 87, 88, 89, 90, 91, 92, 93,
- 94, 95, 96, 97, 98, 99, 100, 100, 101, 101,
- 101, 102
+ 52, 52, 53, 54, 54, 55, 55, 56, 56, 56,
+ 56, 57, 57, 58, 59, 60, 61, 62, 62, 62,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 73, 73, 73, 74, 75, 76, 76, 77,
+ 78, 78, 78, 79, 80, 81, 81, 81, 82, 83,
+ 84, 85, 85, 86, 87, 88, 89, 89, 90, 91,
+ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
+ 102, 102, 103, 103, 103, 104
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -753,15 +756,15 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 1, 1, 1, 2, 1, 1, 1, 1,
1, 1, 4, 5, 0, 3, 5, 0, 3, 4,
- 6, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 10, 1, 1, 3, 3, 0, 3, 3, 2, 0,
- 2, 5, 4, 10, 6, 0, 3, 3, 2, 8,
- 1, 1, 6, 1, 1, 1, 6, 1, 10, 0,
- 3, 3, 2, 5, 5, 8, 7, 0, 3, 2,
- 6, 3, 0, 3, 2, 1, 8, 1, 1, 3,
- 5, 4, 1, 1, 5, 13, 1, 1, 1, 1,
- 1, 1, 1, 7, 1, 1, 10, 3, 0, 2,
- 3, 6
+ 6, 1, 1, 1, 1, 1, 1, 1, 1, 3,
+ 1, 1, 10, 1, 1, 3, 3, 0, 3, 3,
+ 2, 0, 2, 5, 4, 10, 6, 0, 3, 3,
+ 2, 8, 1, 1, 6, 1, 1, 1, 6, 1,
+ 10, 0, 3, 3, 2, 5, 5, 8, 1, 7,
+ 0, 3, 2, 6, 3, 0, 3, 2, 1, 8,
+ 1, 1, 1, 3, 5, 4, 1, 1, 5, 13,
+ 1, 1, 1, 1, 1, 1, 1, 7, 1, 1,
+ 10, 3, 0, 2, 3, 6
};
diff --git a/src/wkt1_grammar.y b/src/wkt1_grammar.y
index e17135c6..4a767997 100644
--- a/src/wkt1_grammar.y
+++ b/src/wkt1_grammar.y
@@ -128,7 +128,11 @@ integer:
/* 7.2 Coordinate System WKT */
coordinate_system:
- horz_cs | geocentric_cs | vert_cs | compd_cs | fitted_cs | local_cs
+ horz_cs_with_opt_esri_vertcs | geocentric_cs | vert_cs | compd_cs | fitted_cs | local_cs
+
+horz_cs_with_opt_esri_vertcs:
+ horz_cs
+ | horz_cs ',' esri_vert_cs
horz_cs:
geographic_cs | projected_cs
@@ -217,7 +221,10 @@ authority:
vert_cs:
T_VERT_CS begin_node_name ',' vert_datum ',' linear_unit opt_axis_authority end_node
- | T_VERTCS begin_node_name ',' vdatum ',' opt_parameter_list_linear_unit end_node
+ | esri_vert_cs
+
+esri_vert_cs:
+ T_VERTCS begin_node_name ',' vdatum ',' opt_parameter_list_linear_unit end_node
opt_axis_authority:
| ',' axis opt_authority
@@ -240,10 +247,12 @@ compd_cs:
T_COMPD_CS begin_node_name ',' head_cs ',' tail_cs opt_extension_authority end_node
head_cs:
- coordinate_system
+ horz_cs
+// Accepting a geographic CRS as part of the second CRS of a COMPD_CS is horrible
+// but found in LAS WKT
tail_cs:
- coordinate_system
+ geographic_cs | vert_cs
twin_axis: axis ',' axis
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 055b1e1d..cc9465ea 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -2692,6 +2692,38 @@ TEST(wkt_parse,
// ---------------------------------------------------------------------------
+TEST(wkt_parse, implicit_compound_CRS_ESRI) {
+ // See https://lists.osgeo.org/pipermail/gdal-dev/2020-October/052843.html
+ // and https://pro.arcgis.com/en/pro-app/arcpy/classes/spatialreference.htm
+ const char *wkt =
+ "PROJCS[\"NAD_1983_2011_StatePlane_Colorado_Central_FIPS_0502_Ft_US\","
+ "GEOGCS[\"GCS_NAD_1983_2011\",DATUM[\"D_NAD_1983_2011\","
+ "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
+ "PRIMEM[\"Greenwich\",0.0],"
+ "UNIT[\"Degree\",0.0174532925199433]],"
+ "PROJECTION[\"Lambert_Conformal_Conic\"],"
+ "PARAMETER[\"False_Easting\",3000000.00031608],"
+ "PARAMETER[\"False_Northing\",999999.999996],"
+ "PARAMETER[\"Central_Meridian\",-105.5],"
+ "PARAMETER[\"Standard_Parallel_1\",38.45],"
+ "PARAMETER[\"Standard_Parallel_2\",39.75],"
+ "PARAMETER[\"Latitude_Of_Origin\",37.8333333333333],"
+ "UNIT[\"US survey foot\",0.304800609601219]],"
+ "VERTCS[\"CGVD2013_height\","
+ "VDATUM[\"Canadian_Geodetic_Vertical_Datum_of_2013\"],"
+ "PARAMETER[\"Vertical_Shift\",0.0],"
+ "PARAMETER[\"Direction\",1.0],"
+ "UNIT[\"Meter\",1.0]]";
+ auto dbContext = DatabaseContext::create();
+ auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
+ auto crs = nn_dynamic_pointer_cast<CompoundCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->nameStr(), "NAD83(2011) / Colorado Central (ftUS) + "
+ "CGVD2013(CGG2013) height");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(wkt_parse, COORDINATEOPERATION) {
std::string src_wkt;