File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,19 @@ inline std::size_t write_header_with_length(std::string *str,
8181 return offset;
8282}
8383
84+ // / Create EWKB Point geometry.
85+ inline std::string create_point (double x, double y, uint32_t srid = 4326 )
86+ {
87+ std::string data;
88+ data.reserve (25 ); // Point geometries are always 25 bytes
89+
90+ write_header (&data, wkb_point, srid);
91+ str_push (&data, x);
92+ str_push (&data, y);
93+
94+ return data;
95+ }
96+
8497/* *
8598 * Writer for EWKB data suitable for postgres.
8699 *
@@ -124,12 +137,7 @@ class writer_t
124137
125138 std::string make_point (osmium::geom::Coordinates const &xy) const
126139 {
127- std::string data;
128- write_header (&data, wkb_point, m_srid);
129- str_push (&data, xy.x );
130- str_push (&data, xy.y );
131-
132- return data;
140+ return create_point (xy.x , xy.y , m_srid);
133141 }
134142
135143 /* LineString */
You can’t perform that action at this time.
0 commit comments