File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -8015,7 +8015,12 @@ WKTParser::attachDatabaseContext(const DatabaseContextPtr &dbContext) {
8015
8015
/* * \brief Guess the "dialect" of the WKT string.
8016
8016
*/
8017
8017
WKTParser::WKTGuessedDialect
8018
- WKTParser::guessDialect (const std::string &wkt) noexcept {
8018
+ WKTParser::guessDialect (const std::string &inputWkt) noexcept {
8019
+ std::string wkt = inputWkt;
8020
+ std::size_t idxFirstCharNotSpace = wkt.find_first_not_of (" \t\r\n " );
8021
+ if (idxFirstCharNotSpace > 0 && idxFirstCharNotSpace != std::string::npos) {
8022
+ wkt = wkt.substr (idxFirstCharNotSpace);
8023
+ }
8019
8024
if (ci_starts_with (wkt, WKTConstants::VERTCS)) {
8020
8025
return WKTGuessedDialect::WKT1_ESRI;
8021
8026
}
Original file line number Diff line number Diff line change @@ -2227,7 +2227,7 @@ TEST_F(CApi, proj_context_guess_wkt_dialect) {
2227
2227
2228
2228
EXPECT_EQ (proj_context_guess_wkt_dialect (
2229
2229
nullptr ,
2230
- " GEOGCRS [\" WGS 84\" ,\n "
2230
+ " \n\t\r GEOGCRS [\" WGS 84\" ,\n "
2231
2231
" DATUM[\" World Geodetic System 1984\" ,\n "
2232
2232
" ELLIPSOID[\" WGS 84\" ,6378137,298.257223563]],\n "
2233
2233
" CS[ellipsoidal,2],\n "
You can’t perform that action at this time.
0 commit comments