@@ -72,40 +72,10 @@ void parse_stats_t::possibly_print_status()
7272 print_status (now);
7373}
7474
75- parse_osmium_t ::parse_osmium_t (boost::optional<std::string> const &bbox,
76- bool do_append, osmdata_t *osmdata)
77- : m_data(osmdata), m_append(do_append)
78- {
79- if (bbox) {
80- m_bbox = parse_bbox (bbox);
81- }
82- }
83-
84- osmium::Box parse_osmium_t::parse_bbox (boost::optional<std::string> const &bbox)
85- {
86- double minx, maxx, miny, maxy;
87- int const n =
88- sscanf (bbox->c_str (), " %lf,%lf,%lf,%lf" , &minx, &miny, &maxx, &maxy);
89- if (n != 4 ) {
90- throw std::runtime_error{" Bounding box must be specified like: "
91- " minlon,minlat,maxlon,maxlat\n " };
92- }
93-
94- if (maxx <= minx) {
95- throw std::runtime_error{
96- " Bounding box failed due to maxlon <= minlon\n " };
97- }
98-
99- if (maxy <= miny) {
100- throw std::runtime_error{
101- " Bounding box failed due to maxlat <= minlat\n " };
102- }
103-
104- fmt::print (stderr, " Applying Bounding box: {},{} to {},{}\n " , minx, miny,
105- maxx, maxy);
106-
107- return osmium::Box (minx, miny, maxx, maxy);
108- }
75+ parse_osmium_t ::parse_osmium_t (osmium::Box const &bbox, bool append,
76+ osmdata_t *osmdata)
77+ : m_data(osmdata), m_bbox(bbox), m_append(append)
78+ {}
10979
11080void parse_osmium_t::stream_file (std::string const &filename,
11181 std::string const &fmt)
@@ -162,7 +132,7 @@ void parse_osmium_t::node(osmium::Node const &node)
162132 return ;
163133 }
164134
165- if (!m_bbox || m_bbox-> contains (node.location ())) {
135+ if (!m_bbox. valid () || m_bbox. contains (node.location ())) {
166136 if (m_append) {
167137 m_data->node_modify (node);
168138 } else {
0 commit comments