diff --git a/src/lib/marble/declarative/Placemark.cpp b/src/lib/marble/declarative/Placemark.cpp --- a/src/lib/marble/declarative/Placemark.cpp +++ b/src/lib/marble/declarative/Placemark.cpp @@ -59,44 +59,40 @@ QString Placemark::description() const { if (m_description.isEmpty()) { - m_description = m_placemark.description(); - - if (m_description.isEmpty()) { - auto const category = m_placemark.visualCategory(); - m_description = categoryName(category); - if (category >= GeoDataFeature::FoodBar && category <= GeoDataFeature::FoodRestaurant) { - addTagValue("brand"); - addTagValue("cuisine"); - addTagDescription(m_description, "self_service", "yes", "Self Service"); - addTagDescription(m_description, "takeaway", "yes", "Take Away"); - addTagDescription(m_description, "outdoor_seating", "yes", "Outdoor Seating"); - addTagDescription(m_description, "ice_cream", "yes", "Ice Cream"); - addTagDescription(m_description, "smoking", "dedicated", "Smoking (dedicated)"); - addTagDescription(m_description, "smoking", "yes", "Smoking allowed"); - addTagDescription(m_description, "smoking", "separated", "Smoking (separated)"); - addTagDescription(m_description, "smoking", "isolated", "Smoking (isolated)"); - addTagDescription(m_description, "smoking", "no", "No smoking"); - addTagDescription(m_description, "smoking", "outside", "Smoking (outside)"); - addTagDescription(m_description, "smoking:outside", "yes", "Smoking (outside)"); - addTagDescription(m_description, "smoking:outside", "separated", "Smoking (outside separated)"); - addTagDescription(m_description, "smoking:outside", "no", "No smoking outside"); - } else if (category >= GeoDataFeature::ShopBeverages && category <= GeoDataFeature::Shop) { - addTagValue("operator"); - } else if (category == GeoDataFeature::TransportBusStop) { - addTagValue("network"); - addTagValue("operator"); - addTagValue("ref"); - } else if (category == GeoDataFeature::TransportCarShare) { - addTagValue("network"); - addTagValue("operator"); - } else if (category == GeoDataFeature::TransportFuel) { - addTagValue("brand"); - addTagValue("operator"); - } else if (category == GeoDataFeature::NaturalTree) { - addTagValue("species:en"); - addTagValue("genus:en"); - addTagValue("leaf_type"); - } + auto const category = m_placemark.visualCategory(); + m_description = categoryName(category); + if (category >= GeoDataFeature::FoodBar && category <= GeoDataFeature::FoodRestaurant) { + addTagValue("brand"); + addTagValue("cuisine"); + addTagDescription(m_description, "self_service", "yes", "Self Service"); + addTagDescription(m_description, "takeaway", "yes", "Take Away"); + addTagDescription(m_description, "outdoor_seating", "yes", "Outdoor Seating"); + addTagDescription(m_description, "ice_cream", "yes", "Ice Cream"); + addTagDescription(m_description, "smoking", "dedicated", "Smoking (dedicated)"); + addTagDescription(m_description, "smoking", "yes", "Smoking allowed"); + addTagDescription(m_description, "smoking", "separated", "Smoking (separated)"); + addTagDescription(m_description, "smoking", "isolated", "Smoking (isolated)"); + addTagDescription(m_description, "smoking", "no", "No smoking"); + addTagDescription(m_description, "smoking", "outside", "Smoking (outside)"); + addTagDescription(m_description, "smoking:outside", "yes", "Smoking (outside)"); + addTagDescription(m_description, "smoking:outside", "separated", "Smoking (outside separated)"); + addTagDescription(m_description, "smoking:outside", "no", "No smoking outside"); + } else if (category >= GeoDataFeature::ShopBeverages && category <= GeoDataFeature::Shop) { + addTagValue("operator"); + } else if (category == GeoDataFeature::TransportBusStop) { + addTagValue("network"); + addTagValue("operator"); + addTagValue("ref"); + } else if (category == GeoDataFeature::TransportCarShare) { + addTagValue("network"); + addTagValue("operator"); + } else if (category == GeoDataFeature::TransportFuel) { + addTagValue("brand"); + addTagValue("operator"); + } else if (category == GeoDataFeature::NaturalTree) { + addTagValue("species:en"); + addTagValue("genus:en"); + addTagValue("leaf_type"); } } @@ -106,15 +102,8 @@ QString Placemark::address() const { if (m_address.isEmpty()) { - m_address = addressFromExtendedData(); - if (m_address.isEmpty()) { - m_address = addressFromOsmData(); - } - if (m_address.isEmpty()) { - m_address = m_placemark.address(); - } + m_address = addressFromOsmData(); } - return m_address; } diff --git a/src/plugins/runner/nominatim-search/OsmNominatimSearchRunner.cpp b/src/plugins/runner/nominatim-search/OsmNominatimSearchRunner.cpp --- a/src/plugins/runner/nominatim-search/OsmNominatimSearchRunner.cpp +++ b/src/plugins/runner/nominatim-search/OsmNominatimSearchRunner.cpp @@ -17,7 +17,7 @@ #include "GeoDataExtendedData.h" #include "HttpDownloadManager.h" #include "osm/OsmPresetLibrary.h" - +#include "osm/OsmPlacemarkData.h" #include #include @@ -122,6 +122,8 @@ QString key = attributes.namedItem("class").nodeValue(); QString value = attributes.namedItem("type").nodeValue(); + OsmPlacemarkData data; + GeoDataExtendedData placemarkData = extractChildren(place); placemarkData.addValue( GeoDataData( "class", key ) ); placemarkData.addValue( GeoDataData( "type", value ) ); @@ -145,6 +147,9 @@ administrative = place.firstChildElement("region").text(); if( administrative.isEmpty() ) { administrative = place.firstChildElement("state").text(); + data.addTag("addr:state", administrative); + } else { + data.addTag("district", administrative); } } @@ -169,12 +174,14 @@ placemarkName += ", "; } placemarkName += road; + data.addTag("addr:street", road); } if (!city.isEmpty() && !placemarkName.contains(",") && city != placemarkName) { if( !placemarkName.isEmpty() ) { placemarkName += ", "; } placemarkName += city; + data.addTag("addr:city", city); } if (!administrative.isEmpty()&& !placemarkName.contains(",") && administrative != placemarkName) { if( !placemarkName.isEmpty() ) { @@ -187,6 +194,7 @@ placemarkName += ", "; } placemarkName += country; + data.addTag("addr:country", country); } if (placemarkName.isEmpty()) { placemarkName = desc; @@ -198,6 +206,7 @@ GeoDataFeature::GeoDataVisualCategory category = OsmPresetLibrary::osmVisualCategory( key + '=' + value ); placemark->setVisualCategory( category ); placemark->setExtendedData(placemarkData); + placemark->setOsmData(data); placemarks << placemark; } }