Commit dfc727b3 authored by Volker Krause's avatar Volker Krause
Browse files

Implement GeoJson polygon writing

Needed by the Transport API Repository sync tool, as part of simplifying
coverage area polygons.
parent af27e9d9
......@@ -98,3 +98,18 @@ QJsonObject GeoJson::writeLineString(const QPolygonF &lineString)
obj.insert(QLatin1String("coordinates"), coords);
return obj;
QJsonObject GeoJson::writePolygon(const QPolygonF &polygon)
QJsonObject obj;
obj.insert(QLatin1String("type"), QLatin1String("Polygon"));
QJsonArray coords;
for (const auto &p : polygon) {
QJsonArray polyArray;
obj.insert(QLatin1String("coordinates"), polyArray);
return obj;
......@@ -31,6 +31,9 @@ namespace GeoJson
/** Creates a line string object. */
QJsonObject writeLineString(const QPolygonF &lineString);
/** Create a polygon object. */
QJsonObject writePolygon(const QPolygonF &polygon);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment