Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Zverev <zverik@textual.ru>2017-10-12 15:30:02 +0300
committerArsentiy Milchakov <milcars@mapswithme.com>2017-10-13 16:43:04 +0300
commit5617d65095703cd6d879559576e969da4fd3d9e2 (patch)
tree459296931af14751f161ebf527e1cec125572edf /feature_list/feature_list.cpp
parentd80392371f059cdf2d6c336c94cf4ca5cdb13667 (diff)
[scripts] Update feature_list and generate_planet
Diffstat (limited to 'feature_list/feature_list.cpp')
-rw-r--r--feature_list/feature_list.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/feature_list/feature_list.cpp b/feature_list/feature_list.cpp
index f74e37f05f..06be6aa78e 100644
--- a/feature_list/feature_list.cpp
+++ b/feature_list/feature_list.cpp
@@ -180,7 +180,9 @@ public:
{
f.ParseBeforeStatistic();
string const & category = GetReadableType(f);
- if (!f.HasName() || f.GetFeatureType() == feature::GEOM_LINE || category.empty())
+ // "operator" is a reserved word, hence "operatr". This word is pretty common in C++ projects.
+ string const & operatr = f.GetMetadata().Get(feature::Metadata::FMD_OPERATOR);
+ if ((!f.HasName() && operatr.empty()) || f.GetFeatureType() == feature::GEOM_LINE || category.empty())
return;
m2::PointD const & center = FindCenter(f);
ms::LatLon const & ll = MercatorBounds::ToLatLon(center);
@@ -195,23 +197,34 @@ public:
string const & mwmName = f.GetID().GetMwmName();
string name, secondary;
f.GetPreferredNames(name, secondary);
+ if (name.empty())
+ name = operatr;
string const & uid = BuildUniqueId(ll, name);
string const & lat = strings::to_string_with_digits_after_comma(ll.lat, 6);
string const & lon = strings::to_string_with_digits_after_comma(ll.lon, 6);
search::ReverseGeocoder::Address addr;
string addrStreet = "";
string addrHouse = "";
+ double constexpr kDistanceThresholdMeters = 0.5;
if (m_geocoder.GetExactAddress(f, addr))
{
addrStreet = addr.GetStreetName();
addrHouse = addr.GetHouseNumber();
}
+ else
+ {
+ m_geocoder.GetNearbyAddress(center, addr);
+ if (addr.GetDistance() < kDistanceThresholdMeters)
+ {
+ addrStreet = addr.GetStreetName();
+ addrHouse = addr.GetHouseNumber();
+ }
+ }
string const & phone = f.GetMetadata().Get(feature::Metadata::FMD_PHONE_NUMBER);
string const & website = f.GetMetadata().Get(feature::Metadata::FMD_WEBSITE);
string cuisine = f.GetMetadata().Get(feature::Metadata::FMD_CUISINE);
replace(cuisine.begin(), cuisine.end(), ';', ',');
string const & stars = f.GetMetadata().Get(feature::Metadata::FMD_STARS);
- string const & operatr = f.GetMetadata().Get(feature::Metadata::FMD_OPERATOR);
string const & internet = f.GetMetadata().Get(feature::Metadata::FMD_INTERNET);
string const & denomination = f.GetMetadata().Get(feature::Metadata::FMD_DENOMINATION);
string const & wheelchair = GetWheelchairType(f);
@@ -284,8 +297,6 @@ int main(int argc, char ** argv)
mwms);
for (auto & mwm : mwms)
{
- if (argc > 3 && !strings::StartsWith(mwm.GetCountryName(), argv[3]))
- continue;
mwm.SyncWithDisk();
auto const & p = index.RegisterMap(mwm);
CHECK_EQUAL(MwmSet::RegResult::Success, p.second, ("Could not register map", mwm));
@@ -301,6 +312,8 @@ int main(int argc, char ** argv)
{
if (mwmInfo->GetType() != MwmInfo::COUNTRY)
continue;
+ if (argc > 3 && !strings::StartsWith(mwmInfo->GetCountryName() + DATA_FILE_EXTENSION, argv[3]))
+ continue;
LOG(LINFO, ("Processing", mwmInfo->GetCountryName()));
MwmSet::MwmId mwmId(mwmInfo);
Index::FeaturesLoaderGuard loader(index, mwmId);