@@ -499,10 +499,39 @@ void output_flex_t::way_cache_t::init(osmium::Way *way)
499499 m_way = way;
500500}
501501
502+ static std::size_t get_nodes (middle_query_t const &middle, osmium::Way *way)
503+ {
504+ constexpr std::size_t const max_missing_nodes = 100 ;
505+ static std::size_t count_missing_nodes = 0 ;
506+
507+ auto const count = middle.nodes_get_list (&way->nodes ());
508+
509+ if (count_missing_nodes <= max_missing_nodes &&
510+ count != way->nodes ().size ()) {
511+ util::string_joiner_t id_list{' ,' };
512+ for (auto const &nr : way->nodes ()) {
513+ if (!nr.location ().valid ()) {
514+ id_list.add (fmt::to_string (nr.ref ()));
515+ ++count_missing_nodes;
516+ }
517+ }
518+
519+ log_debug (" Missing nodes in way {}: {}" , way->id (), id_list ());
520+
521+ if (count_missing_nodes > max_missing_nodes) {
522+ log_debug (" Reported more than {} missing nodes, no further missing "
523+ " nodes will be reported!" ,
524+ max_missing_nodes);
525+ }
526+ }
527+
528+ return count;
529+ }
530+
502531std::size_t output_flex_t::way_cache_t::add_nodes (middle_query_t const &middle)
503532{
504533 if (m_num_way_nodes == std::numeric_limits<std::size_t >::max ()) {
505- m_num_way_nodes = middle. nodes_get_list (& m_way-> nodes () );
534+ m_num_way_nodes = get_nodes (middle, m_way);
506535 }
507536
508537 return m_num_way_nodes;
@@ -547,7 +576,7 @@ bool output_flex_t::relation_cache_t::add_members(middle_query_t const &middle)
547576 }
548577
549578 for (auto &way : m_members_buffer.select <osmium::Way>()) {
550- middle. nodes_get_list (&( way. nodes ()) );
579+ get_nodes (middle, & way);
551580 }
552581 }
553582
0 commit comments