@@ -51,7 +51,15 @@ void gazetteer_style_t::clear()
5151bool gazetteer_style_t::has_place (std::string const &cls) const
5252{
5353 return std::any_of (m_main.begin (), m_main.end (), [&](pmaintag_t const &e) {
54- return strcmp (std::get<0 >(e), cls.c_str ()) == 0 ;
54+ if (strcmp (std::get<0 >(e), cls.c_str ()) == 0 ) {
55+ if (std::get<2 >(e) & SF_MAIN_NAMED)
56+ return !m_names.empty ();
57+ // XXX should handle SF_MAIN_NAMED_KEY as well
58+
59+ return true ;
60+ }
61+
62+ return false ;
5563 });
5664}
5765
@@ -381,7 +389,7 @@ void gazetteer_style_t::process_tags(osmium::OSMObject const &o)
381389 }
382390}
383391
384- void gazetteer_style_t::copy_out (osmium::OSMObject const &o,
392+ bool gazetteer_style_t::copy_out (osmium::OSMObject const &o,
385393 std::string const &geom, db_copy_mgr_t &buffer)
386394{
387395 bool any = false ;
@@ -391,14 +399,17 @@ void gazetteer_style_t::copy_out(osmium::OSMObject const &o,
391399 }
392400 }
393401
394- if (!any) {
395- for (auto const &main : m_main) {
396- if ((std::get<2 >(main) & SF_MAIN_FALLBACK) &&
397- copy_out_maintag (main, o, geom, buffer)) {
398- break ;
399- }
402+ if (any)
403+ return true ;
404+
405+ for (auto const &main : m_main) {
406+ if ((std::get<2 >(main) & SF_MAIN_FALLBACK) &&
407+ copy_out_maintag (main, o, geom, buffer)) {
408+ return true ;
400409 }
401410 }
411+
412+ return false ;
402413}
403414
404415bool gazetteer_style_t::copy_out_maintag (pmaintag_t const &tag,
0 commit comments