1 #ifndef OSMIUM_GEOM_GEOJSON_HPP
2 #define OSMIUM_GEOM_GEOJSON_HPP
49 class GeoJSONFactoryImpl {
56 typedef std::string point_type;
57 typedef std::string linestring_type;
58 typedef std::string polygon_type;
59 typedef std::string multipolygon_type;
60 typedef std::string ring_type;
62 GeoJSONFactoryImpl(
int precision = 7) :
63 m_precision(precision) {
70 std::string str {
"{\"type\":\"Point\",\"coordinates\":"};
79 void linestring_start() {
80 m_str =
"{\"type\":\"LineString\",\"coordinates\":[";
88 linestring_type linestring_finish(
size_t ) {
89 assert(!m_str.empty());
91 std::swap(str, m_str);
99 void multipolygon_start() {
100 m_str =
"{\"type\":\"MultiPolygon\",\"coordinates\":[";
103 void multipolygon_polygon_start() {
107 void multipolygon_polygon_finish() {
111 void multipolygon_outer_ring_start() {
115 void multipolygon_outer_ring_finish() {
116 assert(!m_str.empty());
120 void multipolygon_inner_ring_start() {
124 void multipolygon_inner_ring_finish() {
125 assert(!m_str.empty());
134 multipolygon_type multipolygon_finish() {
135 assert(!m_str.empty());
137 std::swap(str, m_str);
147 template <
class TProjection = IdentityProjection>
154 #endif // OSMIUM_GEOM_GEOJSON_HPP
Definition: factory.hpp:146
Namespace for everything in the Osmium library.
Definition: assembler.hpp:55
Definition: coordinates.hpp:47
void append_to_string(std::string &s, const char infix, int precision) const
Definition: coordinates.hpp:58