Skip to content

v0.2.48..v0.2.49 changeset OsmGeoJsonWriter.cpp

Garret Voltz edited this page Oct 2, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/OsmGeoJsonWriter.cpp b/hoot-core/src/main/cpp/hoot/core/io/OsmGeoJsonWriter.cpp
index 9c88a95..5bdc40b 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/OsmGeoJsonWriter.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/io/OsmGeoJsonWriter.cpp
@@ -96,6 +96,23 @@ void OsmGeoJsonWriter::write(const ConstOsmMapPtr& map)
   close();
 }
 
+// Taken directly from OsmXmlWriter.
+QString OsmGeoJsonWriter::toString(const ConstOsmMapPtr& map)
+{
+  QBuffer buf;
+
+  if (!buf.open(QBuffer::WriteOnly))
+  {
+    throw InternalErrorException(QObject::tr("Error opening QBuffer for writing. Odd."));
+  }
+
+  _out = &buf;
+  write(map);
+  _out = 0;
+
+  return QString::fromUtf8(buf.buffer());
+}
+
 QString OsmGeoJsonWriter::_getBbox()
 {
   Envelope bounds = CalculateMapBoundsVisitor::getGeosBounds(_map);
Clone this wiki locally