Skip to content

Commit

Permalink
Allow geosop to accept isWKTLiteral with (e.g.) "point empty"
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Nov 6, 2023
1 parent 13c25a8 commit f89a64b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion util/geosop/GeosOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,12 @@ std::vector<std::unique_ptr<Geometry>> collect( std::vector<std::unique_ptr<Geom

bool isWKTLiteral(std::string s) {
// check for empty geoms (which do not have parens)
if (endsWith(s, " EMPTY")) return true;
const size_t slen = s.size();
if (slen < 6) return false;
auto lastWord = s.substr(slen - 6, slen);
for (char& c : lastWord)
c = static_cast<char>(toupper(static_cast<unsigned char>(c)));
if ( lastWord.compare(" EMPTY") == 0 ) return true;

// assume if string contains a ( it is WKT
auto numLParen = std::count(s.begin(), s.end(), '(');
Expand Down

0 comments on commit f89a64b

Please sign in to comment.