@@ -9,8 +9,24 @@ input_handler_t::input_handler_t(osmium::Box const &bbox, bool append,
99: m_data(osmdata), m_bbox(bbox), m_append(append)
1010{}
1111
12+ void input_handler_t::negative_id_warning ()
13+ {
14+ fmt::print (
15+ stderr,
16+ " \n WARNING: The input file contains at least one object with a\n "
17+ " negative id. Negative ids are not properly supported\n "
18+ " in osm2pgsql (and never were). They will not work in\n "
19+ " future versions at all. You can use the osmium tool to\n "
20+ " 'renumber' your file.\n\n " );
21+ m_issued_warning_negative_id = true ;
22+ }
23+
1224void input_handler_t::node (osmium::Node const &node)
1325{
26+ if (node.id () < 0 && !m_issued_warning_negative_id) {
27+ negative_id_warning ();
28+ }
29+
1430 if (m_type != osmium::item_type::node) {
1531 m_type = osmium::item_type::node;
1632 m_data->flush ();
@@ -50,6 +66,10 @@ void input_handler_t::node(osmium::Node const &node)
5066
5167void input_handler_t::way (osmium::Way &way)
5268{
69+ if (way.id () < 0 && !m_issued_warning_negative_id) {
70+ negative_id_warning ();
71+ }
72+
5373 if (m_type != osmium::item_type::way) {
5474 m_type = osmium::item_type::way;
5575 m_data->flush ();
@@ -73,6 +93,10 @@ void input_handler_t::way(osmium::Way &way)
7393
7494void input_handler_t::relation (osmium::Relation const &rel)
7595{
96+ if (rel.id () < 0 && !m_issued_warning_negative_id) {
97+ negative_id_warning ();
98+ }
99+
76100 if (m_type != osmium::item_type::relation) {
77101 m_type = osmium::item_type::relation;
78102 m_data->flush ();
0 commit comments