From d50e65cb1f681193a1598fb2df2a3d6168101d58 Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Wed, 25 Sep 2024 12:11:47 +0200 Subject: [PATCH] support full geojson export of GEOMETRYCOLLECTIONs --- src/qlever-petrimaps/GeomCache.cpp | 8 -------- src/qlever-petrimaps/server/Server.cpp | 7 +++++++ src/util | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/qlever-petrimaps/GeomCache.cpp b/src/qlever-petrimaps/GeomCache.cpp index d71a6bf..21a3bf0 100644 --- a/src/qlever-petrimaps/GeomCache.cpp +++ b/src/qlever-petrimaps/GeomCache.cpp @@ -831,14 +831,6 @@ std::vector GeomCache::getGeomStarts(const std::string &str, size_t p) { a++; } - a = p; - while (1) { - a = str.find("GEOMETRYCOLLECTION(", a); - if (a == std::string::npos) break; - starts.push_back(a); - a++; - } - starts.push_back(std::string::npos); std::sort(starts.begin(), starts.end()); diff --git a/src/qlever-petrimaps/server/Server.cpp b/src/qlever-petrimaps/server/Server.cpp index c5966c0..134d837 100755 --- a/src/qlever-petrimaps/server/Server.cpp +++ b/src/qlever-petrimaps/server/Server.cpp @@ -1116,6 +1116,13 @@ util::http::Answer Server::handleExportReq(const Params& pars, int sock) const { first = true; } catch (std::runtime_error& e) { } + try { + auto geom = util::geo::collectionFromWKT(wkt); + if (first) ss << ","; + geoJsonOut.print(geom, dict); + first = true; + } catch (std::runtime_error& e) { + } ss << "\n"; } diff --git a/src/util b/src/util index 8eb25a8..c26d22b 160000 --- a/src/util +++ b/src/util @@ -1 +1 @@ -Subproject commit 8eb25a88d6a0235e1401e028414bf487725d96d9 +Subproject commit c26d22bfbff91057e230d01e5e92c71e5f12b604