1#ifndef OSMIUM_GEOM_RAPID_GEOJSON_HPP
2#define OSMIUM_GEOM_RAPID_GEOJSON_HPP
54 template <
typename TWriter>
55 class RapidGeoJSONFactoryImpl {
61 using point_type = void;
62 using linestring_type = void;
63 using polygon_type = void;
64 using multipolygon_type = void;
65 using ring_type = void;
67 RapidGeoJSONFactoryImpl(
int , TWriter& writer) :
75 m_writer->String(
"geometry");
76 m_writer->StartObject();
77 m_writer->String(
"type");
78 m_writer->String(
"Point");
79 m_writer->String(
"coordinates");
80 m_writer->StartArray();
81 m_writer->Double(xy.
x);
82 m_writer->Double(xy.
y);
84 m_writer->EndObject();
90 void linestring_start() {
91 m_writer->String(
"geometry");
92 m_writer->StartObject();
93 m_writer->String(
"type");
94 m_writer->String(
"LineString");
95 m_writer->String(
"coordinates");
96 m_writer->StartArray();
100 m_writer->StartArray();
101 m_writer->Double(xy.
x);
102 m_writer->Double(xy.
y);
103 m_writer->EndArray();
106 linestring_type linestring_finish(
size_t ) {
107 m_writer->EndArray();
108 m_writer->EndObject();
114 void polygon_start() {
115 m_writer->String(
"geometry");
116 m_writer->StartObject();
117 m_writer->String(
"type");
118 m_writer->String(
"Polygon");
119 m_writer->String(
"coordinates");
120 m_writer->StartArray();
121 m_writer->StartArray();
125 m_writer->StartArray();
126 m_writer->Double(xy.
x);
127 m_writer->Double(xy.
y);
128 m_writer->EndArray();
131 polygon_type polygon_finish(
size_t ) {
132 m_writer->EndArray();
133 m_writer->EndArray();
134 m_writer->EndObject();
139 void multipolygon_start() {
140 m_writer->String(
"geometry");
141 m_writer->StartObject();
142 m_writer->String(
"type");
143 m_writer->String(
"MultiPolygon");
144 m_writer->String(
"coordinates");
145 m_writer->StartArray();
148 void multipolygon_polygon_start() {
149 m_writer->StartArray();
152 void multipolygon_polygon_finish() {
153 m_writer->EndArray();
156 void multipolygon_outer_ring_start() {
157 m_writer->StartArray();
160 void multipolygon_outer_ring_finish() {
161 m_writer->EndArray();
164 void multipolygon_inner_ring_start() {
165 m_writer->StartArray();
168 void multipolygon_inner_ring_finish() {
169 m_writer->EndArray();
173 m_writer->StartArray();
174 m_writer->Double(xy.
x);
175 m_writer->Double(xy.
y);
176 m_writer->EndArray();
179 multipolygon_type multipolygon_finish() {
180 m_writer->EndArray();
181 m_writer->EndObject();
188 template <
typename TWriter,
typename TProjection = IdentityProjection>
Definition: factory.hpp:149
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
Definition: coordinates.hpp:48
double y
Definition: coordinates.hpp:51
double x
Definition: coordinates.hpp:50