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:
-rw-r--r--data/classificator.txt1
-rw-r--r--data/drules_proto.binbin250745 -> 250784 bytes
-rw-r--r--data/drules_proto.txt10
-rw-r--r--data/drules_proto_legacy.binbin210057 -> 210112 bytes
-rw-r--r--data/drules_proto_legacy.txt17
-rw-r--r--data/mapcss-mapping.csv1
-rw-r--r--data/types.txt1
-rw-r--r--data/visibility.txt1
-rw-r--r--docs/MAPS.md4
-rw-r--r--generator/aggregating_sponsored_dataset.cpp19
-rw-r--r--generator/aggregating_sponsored_dataset.hpp27
-rw-r--r--generator/booking_dataset.cpp29
-rw-r--r--generator/booking_quality_check/booking_quality_check.cpp4
-rw-r--r--generator/generate_info.hpp5
-rw-r--r--generator/generator.pro2
-rw-r--r--generator/generator_tool/generator_tool.cpp6
-rw-r--r--generator/opentable_dataset.cpp44
-rw-r--r--generator/osm_source.cpp65
-rw-r--r--generator/sponsored_dataset.hpp2
-rw-r--r--generator/sponsored_dataset_inl.hpp14
-rw-r--r--generator/sponsored_scoring.hpp2
-rwxr-xr-xtools/python/opentable_restaurants.py6
-rwxr-xr-xtools/unix/generate_planet.sh10
23 files changed, 145 insertions, 125 deletions
diff --git a/data/classificator.txt b/data/classificator.txt
index ec8ee3506b..787761707d 100644
--- a/data/classificator.txt
+++ b/data/classificator.txt
@@ -807,6 +807,7 @@ world +
{}
sponsored +
booking -
+ opentable -
{}
sport +
american_football -
diff --git a/data/drules_proto.bin b/data/drules_proto.bin
index ad2d1a6f0f..771b7888b4 100644
--- a/data/drules_proto.bin
+++ b/data/drules_proto.bin
Binary files differ
diff --git a/data/drules_proto.txt b/data/drules_proto.txt
index 50a1f4d76c..5126799ffa 100644
--- a/data/drules_proto.txt
+++ b/data/drules_proto.txt
@@ -76690,6 +76690,16 @@ cont {
}
}
cont {
+ name: "sponsored-opentable"
+ element {
+ scale: 18
+ symbol {
+ name: "hotel"
+ priority: 16000
+ }
+ }
+}
+cont {
name: "sport-american_football"
element {
scale: 17
diff --git a/data/drules_proto_legacy.bin b/data/drules_proto_legacy.bin
index 57b2cb9d85..b1389ac033 100644
--- a/data/drules_proto_legacy.bin
+++ b/data/drules_proto_legacy.bin
Binary files differ
diff --git a/data/drules_proto_legacy.txt b/data/drules_proto_legacy.txt
index f059bcddca..7ede85be84 100644
--- a/data/drules_proto_legacy.txt
+++ b/data/drules_proto_legacy.txt
@@ -65015,6 +65015,23 @@ cont {
}
}
cont {
+ name: "sponsored-opentable"
+ element {
+ scale: 18
+ symbol {
+ name: "hotel"
+ priority: 16000
+ }
+ }
+ element {
+ scale: 19
+ symbol {
+ name: "hotel"
+ priority: 16000
+ }
+ }
+}
+cont {
name: "sport-american_football"
element {
scale: 17
diff --git a/data/mapcss-mapping.csv b/data/mapcss-mapping.csv
index 9bee4d8ce9..b2491ce3bd 100644
--- a/data/mapcss-mapping.csv
+++ b/data/mapcss-mapping.csv
@@ -1136,3 +1136,4 @@ olympics|stadium_main;1135;
olympics|stadium;1136;
olympics|water_sport;1137;
olympics|bike_sport;1138;
+sponsored|opentable;1139; \ No newline at end of file
diff --git a/data/types.txt b/data/types.txt
index fd47d4abad..8dda698e86 100644
--- a/data/types.txt
+++ b/data/types.txt
@@ -1136,3 +1136,4 @@ olympics|stadium_main
olympics|stadium
olympics|water_sport
olympics|bike_sport
+sponsored|opentable
diff --git a/data/visibility.txt b/data/visibility.txt
index a02cc92987..3a3b239a10 100644
--- a/data/visibility.txt
+++ b/data/visibility.txt
@@ -807,6 +807,7 @@ world 00000000000000000000 +
{}
sponsored 00000000000000000011 +
booking 00000000000000000011 -
+ opentable 00000000000000000011 -
{}
sport 00000000000000000000 +
american_football 00000000000000000111 -
diff --git a/docs/MAPS.md b/docs/MAPS.md
index ee01dc4452..e90d53267e 100644
--- a/docs/MAPS.md
+++ b/docs/MAPS.md
@@ -143,7 +143,9 @@ Can be empty. Example: `$(ls ../../data/borders/{UK*,Ireland}.poly)`.
* `SRTM_PATH`: a path to `*.zip` files with SRTM data.
* `OSC`: a path to an osmChange file to apply after updating the planet.
* `BOOKING_FILE`: a path to hotels.csv with booking data.
-* `BOOKING_USER` and `BOOKING_PATH`: user name and password for booking.com API
+* `BOOKING_USER` and `BOOKING_PASS`: user name and password for booking.com API
+* `OPENTABLE_FILE`: a path to restaurants.csv with opentable data.
+* `OPENTABLE_USER` and `OPENTABLE_PASS`: user name and password for opentable.com API
to download hotels data.
### Testing
diff --git a/generator/aggregating_sponsored_dataset.cpp b/generator/aggregating_sponsored_dataset.cpp
deleted file mode 100644
index 16a4c3b9b4..0000000000
--- a/generator/aggregating_sponsored_dataset.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "generator/aggregating_sponsored_dataset.hpp"
-
-namespace generator
-{
-bool AggregatingSponsoredDataset::IsMatched(FeatureBuilder1 const & fb) const
-{
- return m_bookingDataset.FindMatchingObjectId(fb) != BookingHotel::InvalidObjectId();
-}
-
-void AggregatingSponsoredDataset::BuildOsmObjects(function<void(FeatureBuilder1 &)> const & fn) const
-{
- m_bookingDataset.BuildOsmObjects(fn);
-}
-
-size_t AggregatingSponsoredDataset::Size() const
-{
- return m_bookingDataset.Size();
-}
-} // namespace generator
diff --git a/generator/aggregating_sponsored_dataset.hpp b/generator/aggregating_sponsored_dataset.hpp
deleted file mode 100644
index 268800f1f5..0000000000
--- a/generator/aggregating_sponsored_dataset.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-#include "generator/booking_dataset.hpp"
-#include "generator/generate_info.hpp"
-
-#include "std/unique_ptr.hpp"
-#include "std/vector.hpp"
-
-namespace generator
-{
-class AggregatingSponsoredDataset
-{
-public:
- explicit AggregatingSponsoredDataset(feature::GenerateInfo const & info)
- : m_bookingDataset(info.m_bookingDatafileName, info.m_bookingReferenceDir)
- {
- }
-
- bool IsMatched(FeatureBuilder1 const & e) const;
- void BuildOsmObjects(function<void(FeatureBuilder1 &)> const & fn) const;
-
- size_t Size() const;
-
-private:
- BookingDataset m_bookingDataset;
-};
-} // namespace generator;
diff --git a/generator/booking_dataset.cpp b/generator/booking_dataset.cpp
index 54abe31340..f445ef83b7 100644
--- a/generator/booking_dataset.cpp
+++ b/generator/booking_dataset.cpp
@@ -72,7 +72,34 @@ bool BookingDataset::NecessaryMatchingConditionHolds(FeatureBuilder1 const & fb)
return ftypes::IsHotelChecker::Instance()(fb.GetTypes());
}
-// TODO(mgsergio): Try to eliminate as much code duplication as possible. (See opentable_dataset.cpp)
+template <>
+void BookingDataset::PreprocessMatchedOsmObject(ObjectId, FeatureBuilder1 & fb,
+ function<void(FeatureBuilder1 &)> const fn) const
+{
+ // Turn a hotel into a simple building.
+ if (fb.GetGeomType() == feature::GEOM_AREA)
+ {
+ // Remove all information about a hotel.
+ auto params = fb.GetParams();
+ params.ClearName();
+ auto & meta = params.GetMetadata();
+ meta.Drop(feature::Metadata::EType::FMD_STARS);
+ meta.Drop(feature::Metadata::EType::FMD_WEBSITE);
+ meta.Drop(feature::Metadata::EType::FMD_PHONE_NUMBER);
+
+ auto const & c = classif();
+ auto const tourism = c.GetTypeByPath({"tourism"});
+ my::EraseIf(params.m_Types, [&c, tourism](uint32_t type)
+ {
+ ftype::TruncValue(type, 1);
+ return type == tourism;
+ });
+ fb.SetParams(params);
+ }
+
+ fn(fb);
+}
+
template <>
void BookingDataset::BuildObject(Object const & hotel,
function<void(FeatureBuilder1 &)> const & fn) const
diff --git a/generator/booking_quality_check/booking_quality_check.cpp b/generator/booking_quality_check/booking_quality_check.cpp
index a5984abbc9..1d06d450d4 100644
--- a/generator/booking_quality_check/booking_quality_check.cpp
+++ b/generator/booking_quality_check/booking_quality_check.cpp
@@ -134,7 +134,7 @@ feature::GenerateInfo GetGenerateInfo()
{
feature::GenerateInfo info;
info.m_bookingDatafileName = FLAGS_booking;
- info.m_opentableDataFile = FLAGS_opentable;
+ info.m_opentableDatafileName = FLAGS_opentable;
info.m_osmFileName = FLAGS_osm;
info.SetNodeStorageType("map");
info.SetOsmFileType("o5m");
@@ -345,7 +345,7 @@ string GetDatasetFilePath<BookingDataset>(feature::GenerateInfo const & info)
template <>
string GetDatasetFilePath<OpentableDataset>(feature::GenerateInfo const & info)
{
- return info.m_opentableDataFile;
+ return info.m_opentableDatafileName;
}
template <typename Dataset, typename Object = typename Dataset::Object>
diff --git a/generator/generate_info.hpp b/generator/generate_info.hpp
index 9a94e8cea4..275ac2e9d8 100644
--- a/generator/generate_info.hpp
+++ b/generator/generate_info.hpp
@@ -42,9 +42,8 @@ struct GenerateInfo
string m_bookingDatafileName;
string m_bookingReferenceDir;
- string m_opentableDataFile;
- // TODO(mgsergio): Uncomment when I need this.
- // string m_opentableReferenceDir;
+ string m_opentableDatafileName;
+ string m_opentableReferenceDir;
uint32_t m_versionDate = 0;
diff --git a/generator/generator.pro b/generator/generator.pro
index 9a7af2819e..918f36e5ed 100644
--- a/generator/generator.pro
+++ b/generator/generator.pro
@@ -15,7 +15,6 @@ INCLUDEPATH *= $$ROOT_DIR/3party/gflags/src \
QT *= core
SOURCES += \
- aggregating_sponsored_dataset.cpp \
altitude_generator.cpp \
booking_dataset.cpp \
booking_scoring.cpp \
@@ -47,7 +46,6 @@ SOURCES += \
unpack_mwm.cpp \
HEADERS += \
- aggregating_sponsored_dataset.hpp \
altitude_generator.hpp \
booking_dataset.hpp \
borders_generator.hpp \
diff --git a/generator/generator_tool/generator_tool.cpp b/generator/generator_tool/generator_tool.cpp
index d2150be490..6024c0d679 100644
--- a/generator/generator_tool/generator_tool.cpp
+++ b/generator/generator_tool/generator_tool.cpp
@@ -74,7 +74,9 @@ DEFINE_string(osm_file_name, "", "Input osm area file.");
DEFINE_string(osm_file_type, "xml", "Input osm area file type [xml, o5m].");
DEFINE_string(user_resource_path, "", "User defined resource path for classificator.txt and etc.");
DEFINE_string(booking_data, "", "Path to booking data in .tsv format.");
-DEFINE_string(booking_reference_path, "", "Path to mwm dataset for match booking addresses.");
+DEFINE_string(booking_reference_path, "", "Path to mwm dataset for booking addresses matching.");
+DEFINE_string(opentable_data, "", "Path to opentable data in .tsv format.");
+DEFINE_string(opentable_reference_path, "", "Path to mwm dataset for opentable addresses matching.");
DEFINE_uint64(planet_version, my::SecondsSinceEpoch(),
"Version as seconds since epoch, by default - now.");
DEFINE_string(srtm_path, "",
@@ -114,6 +116,8 @@ int main(int argc, char ** argv)
genInfo.m_preloadCache = FLAGS_preload_cache;
genInfo.m_bookingDatafileName = FLAGS_booking_data;
genInfo.m_bookingReferenceDir = FLAGS_booking_reference_path;
+ genInfo.m_opentableDatafileName = FLAGS_opentable_data;
+ genInfo.m_opentableReferenceDir = FLAGS_opentable_reference_path;
genInfo.m_versionDate = static_cast<uint32_t>(FLAGS_planet_version);
diff --git a/generator/opentable_dataset.cpp b/generator/opentable_dataset.cpp
index 55b1849a7e..b6738ee0b3 100644
--- a/generator/opentable_dataset.cpp
+++ b/generator/opentable_dataset.cpp
@@ -1,7 +1,7 @@
#include "generator/opentable_dataset.hpp"
-//#include "generator/openatble_scoring.hpp" // or just sonsored scoring
#include "generator/feature_builder.hpp"
+#include "generator/sponsored_scoring.hpp"
#include "indexer/classificator.hpp"
#include "indexer/ftypes_matcher.hpp"
@@ -60,41 +60,28 @@ bool OpentableDataset::NecessaryMatchingConditionHolds(FeatureBuilder1 const & f
if (fb.GetName(StringUtf8Multilang::kDefaultCode).empty())
return false;
- // TODO(mgsergio): Handle all types of restaurants:
- // bar cafe (fast_food ??) pub restaurant
- // return ftypes::IsRestaurantChecker::Instance()(fb.GetTypes());
- return true;
+ return ftypes::IsFoodChecker::Instance()(fb.GetTypes());
}
-// TODO(mgsergio): Try to eliminate as much code duplication as possible. (See booking_dataset.cpp)
template <>
-void OpentableDataset::BuildObject(Object const & restaurant,
- function<void(FeatureBuilder1 &)> const & fn) const
+void OpentableDataset::PreprocessMatchedOsmObject(ObjectId const matchedObjId, FeatureBuilder1 & fb,
+ function<void(FeatureBuilder1 &)> const fn) const
{
- FeatureBuilder1 fb;
- FeatureParams params;
-
- fb.SetCenter(MercatorBounds::FromLatLon(restaurant.m_lat, restaurant.m_lon));
+ FeatureParams params = fb.GetParams();
+ auto restaurant = GetObjectById(matchedObjId);
auto & metadata = params.GetMetadata();
- // TODO(mgsergio): Rename FMD_SPONSORED_ID to FMD_BOOKING_ID.
metadata.Set(feature::Metadata::FMD_SPONSORED_ID, strings::to_string(restaurant.m_id.Get()));
metadata.Set(feature::Metadata::FMD_WEBSITE, restaurant.m_descUrl);
// params.AddAddress(restaurant.address);
// TODO(mgsergio): addr:full ???
- if (!restaurant.m_street.empty())
- fb.AddStreet(restaurant.m_street);
-
- if (!restaurant.m_houseNumber.empty())
- fb.AddHouseNumber(restaurant.m_houseNumber);
-
params.AddName(StringUtf8Multilang::GetLangByCode(StringUtf8Multilang::kDefaultCode),
restaurant.m_name);
auto const & clf = classif();
- params.AddType(clf.GetTypeByPath({"sponsored", "booking"}));
+ params.AddType(clf.GetTypeByPath({"sponsored", "opentable"}));
fb.SetParams(params);
@@ -110,15 +97,14 @@ OpentableDataset::ObjectId OpentableDataset::FindMatchingObjectIdImpl(FeatureBui
return Object::InvalidObjectId();
// Find |kMaxSelectedElements| nearest values to a point.
- auto const bookingIndexes = GetNearestObjects(MercatorBounds::ToLatLon(fb.GetKeyPoint()),
- kMaxSelectedElements, kDistanceLimitInMeters);
-
- CHECK(false, ("Not implemented yet"));
- // for (auto const j : bookingIndexes)
- // {
- // if (booking_scoring::Match(GetObjectById(j), fb).IsMatched())
- // return j;
- // }
+ auto const nearbyIds = GetNearestObjects(MercatorBounds::ToLatLon(fb.GetKeyPoint()),
+ kMaxSelectedElements, kDistanceLimitInMeters);
+
+ for (auto const objId : nearbyIds)
+ {
+ if (sponsored_scoring::Match(GetObjectById(objId), fb).IsMatched())
+ return objId;
+ }
return Object::InvalidObjectId();
}
diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp
index 7088efd5db..9329b55c47 100644
--- a/generator/osm_source.cpp
+++ b/generator/osm_source.cpp
@@ -1,4 +1,3 @@
-#include "generator/aggregating_sponsored_dataset.hpp"
#include "generator/coastlines_generator.hpp"
#include "generator/feature_generator.hpp"
#include "generator/intermediate_data.hpp"
@@ -13,6 +12,9 @@
#include "generator/towns_dumper.hpp"
#include "generator/world_map_generator.hpp"
+#include "generator/booking_dataset.hpp"
+#include "generator/opentable_dataset.hpp"
+
#include "indexer/classificator.hpp"
#include "platform/platform.hpp"
@@ -277,7 +279,8 @@ class MainFeaturesEmitter : public EmitterBase
string m_srcCoastsFile;
bool m_failOnCoasts;
- generator::AggregatingSponsoredDataset m_dataset;
+ generator::BookingDataset m_bookingDataset;
+ generator::OpentableDataset m_opentableDataset;
/// Used to prepare a list of cities to serve as a list of nodes
/// for building a highway graph with OSRM for low zooms.
@@ -300,7 +303,9 @@ public:
MainFeaturesEmitter(feature::GenerateInfo const & info)
: m_skippedElementsPath(info.GetIntermediateFileName("skipped_elements", ".lst"))
, m_failOnCoasts(info.m_failOnCoasts)
- , m_dataset(info)
+ , m_bookingDataset(info.m_bookingDatafileName, info.m_bookingReferenceDir)
+ , m_opentableDataset(info.m_opentableDatafileName, info.m_opentableReferenceDir)
+
{
Classificator const & c = classif();
@@ -342,44 +347,42 @@ public:
static uint32_t const placeType = classif().GetTypeByPath({"place"});
uint32_t const type = fb.GetParams().FindType(placeType, 1);
+ // TODO(mgserigio): Would it be better to have objects that store callback
+ // and can be piped: action-if-cond1 | action-if-cond-2 | ... ?
+ // The first object which perform action terminates the cahin.
if (type != ftype::GetEmptyValue() && !fb.GetName().empty())
{
m_places.ReplaceEqualInRect(
Place(fb, type),
[](Place const & p1, Place const & p2) { return p1.IsEqual(p2); },
[](Place const & p1, Place const & p2) { return p1.IsBetterThan(p2); });
+ return;
}
- else if (m_dataset.IsMatched(fb))
- {
- m_skippedElements << DebugPrint(fb.GetMostGenericOsmId()) << endl;
- // Turn a hotel into a simple building.
- if (fb.GetGeomType() == feature::GEOM_AREA)
+ auto const bookingObjId = m_bookingDataset.FindMatchingObjectId(fb);
+ if (bookingObjId != generator::BookingHotel::InvalidObjectId())
+ {
+ m_bookingDataset.PreprocessMatchedOsmObject(bookingObjId, fb, [this](FeatureBuilder1 & fb)
{
- // Remove all information about a hotel.
- auto params = fb.GetParams();
- params.ClearName();
- auto & meta = params.GetMetadata();
- meta.Drop(feature::Metadata::EType::FMD_STARS);
- meta.Drop(feature::Metadata::EType::FMD_WEBSITE);
- meta.Drop(feature::Metadata::EType::FMD_PHONE_NUMBER);
-
- auto const & c = classif();
- auto const tourism = c.GetTypeByPath({"tourism"});
- my::EraseIf(params.m_Types, [&c, tourism](uint32_t type)
- {
- ftype::TruncValue(type, 1);
- return type == tourism;
- });
- fb.SetParams(params);
-
+ m_skippedElements << "BOOKING\t" << DebugPrint(fb.GetMostGenericOsmId()) << endl;
Emit(fb);
- }
+ });
+ return;
}
- else
+
+ auto const opentableObjId = m_opentableDataset.FindMatchingObjectId(fb);
+ if (opentableObjId != generator::OpentableRestaurant::InvalidObjectId())
{
- Emit(fb);
+ m_opentableDataset.PreprocessMatchedOsmObject(opentableObjId, fb, [this, opentableObjId](FeatureBuilder1 & fb)
+ {
+ m_skippedElements << "OPENTABLE\t" << opentableObjId.Get() << endl;
+ Emit(fb);
+ });
+ return;
}
+
+ LOG(LDEBUG, ("JUST EMIT"));
+ Emit(fb);
}
/// @return false if coasts are not merged and FLAG_fail_on_coasts is set
@@ -387,8 +390,10 @@ public:
{
DumpSkippedElements();
- // Emit all booking objecs to the map.
- m_dataset.BuildOsmObjects([this](FeatureBuilder1 & fb) { Emit(fb); });
+ // Emit all required booking objecs to the map.
+ m_bookingDataset.BuildOsmObjects([this](FeatureBuilder1 & fb) { Emit(fb); });
+ // No opentable objects should be emitted. Opentable data enriches som data
+ // with a link to a restaurant's reservation page.
m_places.ForEach([this](Place const & p)
{
diff --git a/generator/sponsored_dataset.hpp b/generator/sponsored_dataset.hpp
index 100cb2d20c..cce7285451 100644
--- a/generator/sponsored_dataset.hpp
+++ b/generator/sponsored_dataset.hpp
@@ -62,6 +62,8 @@ public:
bool NecessaryMatchingConditionHolds(FeatureBuilder1 const & fb) const;
ObjectId FindMatchingObjectId(FeatureBuilder1 const & e) const;
+ void PreprocessMatchedOsmObject(ObjectId matchedObjId, FeatureBuilder1 & fb,
+ function<void(FeatureBuilder1 &)> const fn) const;
void BuildOsmObjects(function<void(FeatureBuilder1 &)> const & fn) const;
protected:
diff --git a/generator/sponsored_dataset_inl.hpp b/generator/sponsored_dataset_inl.hpp
index dd01099a2b..1c1e774442 100644
--- a/generator/sponsored_dataset_inl.hpp
+++ b/generator/sponsored_dataset_inl.hpp
@@ -134,12 +134,16 @@ void SponsoredDataset<SponsoredObject>::LoadData(istream & src, string const & a
m_objects.emplace(hotel.m_id, hotel);
}
+ // Try to get object address from existing MWMs.
if (!addressReferencePath.empty())
{
LOG(LINFO, ("Reference addresses for sponsored objects", addressReferencePath));
Platform & platform = GetPlatform();
string const backupPath = platform.WritableDir();
- // TODO(mgsergio): What is this for?
+
+ // MWMs can be loaded only from a writebledir or from a resourcedir,
+ // changig resourcedir can lead to probles with classificator, so
+ // we change writebledir.
platform.SetWritableDirForTests(addressReferencePath);
AddressMatcher addressMatcher;
@@ -156,18 +160,16 @@ void SponsoredDataset<SponsoredObject>::LoadData(istream & src, string const & a
if (object.IsAddressPartsFilled())
++matchedNum;
}
- // TODO(mgsergio): Fix names.
LOG(LINFO,
("Num of hotels:", m_objects.size(), "matched:", matchedNum, "empty addresses:", emptyAddr));
- // TODO(mgsergio): What is this for?
platform.SetWritableDirForTests(backupPath);
}
for (auto const & item : m_objects)
{
- auto const & hotel = item.second;
- TBox b(TPoint(hotel.m_lat, hotel.m_lon), TPoint(hotel.m_lat, hotel.m_lon));
- m_rtree.insert(make_pair(b, hotel.m_id));
+ auto const & object = item.second;
+ TBox b(TPoint(object.m_lat, object.m_lon), TPoint(object.m_lat, object.m_lon));
+ m_rtree.insert(make_pair(b, object.m_id));
}
}
} // namespace generator
diff --git a/generator/sponsored_scoring.hpp b/generator/sponsored_scoring.hpp
index a6e7343029..1e342b11bf 100644
--- a/generator/sponsored_scoring.hpp
+++ b/generator/sponsored_scoring.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "generator/booking_dataset.hpp"
+#include "std/string.hpp"
class FeatureBuilder1;
diff --git a/tools/python/opentable_restaurants.py b/tools/python/opentable_restaurants.py
index b4392827aa..4ed17b3b30 100755
--- a/tools/python/opentable_restaurants.py
+++ b/tools/python/opentable_restaurants.py
@@ -33,7 +33,7 @@ class OpentableDownloader(object):
def download(self):
headers = self._add_auth_header({'Content-Type': 'application/json'})
- url = 'https://platform.otqa.com/sync/listings'
+ url = 'https://platform.opentable.com/sync/listings'
with open(self.opentable_filename, 'w') as f:
offset = 0
@@ -57,7 +57,7 @@ class OpentableDownloader(object):
offset += items_count
def _get_token(self):
- url = 'https://oauth-pp.opentable.com/api/v2/oauth/token?grant_type=client_credentials'
+ url = 'https://oauth.opentable.com/api/v2/oauth/token?grant_type=client_credentials'
headers = self._add_auth_header({})
request = urllib2.Request(url, headers=headers)
logging.debug('Fetching token with headers %s', str(headers))
@@ -111,7 +111,7 @@ if __name__ == '__main__':
loader.download()
if args.tsv is not None:
data = open(args.opentable_data)
- tsv = open(args.tsv) if args.tsv else sys.stdout
+ tsv = open(args.tsv, 'w') if args.tsv else sys.stdout
try:
make_tsv(data, tsv)
finally:
diff --git a/tools/unix/generate_planet.sh b/tools/unix/generate_planet.sh
index 74c18ed928..0d6749bb5a 100755
--- a/tools/unix/generate_planet.sh
+++ b/tools/unix/generate_planet.sh
@@ -170,6 +170,8 @@ ROADS_SCRIPT="$PYTHON_SCRIPTS_PATH/road_runner.py"
HIERARCHY_SCRIPT="$PYTHON_SCRIPTS_PATH/hierarchy_to_countries.py"
BOOKING_SCRIPT="$PYTHON_SCRIPTS_PATH/booking_hotels.py"
BOOKING_FILE="${BOOKING_FILE:-$INTDIR/hotels.csv}"
+OPENTABLE_SCRIPT="$PYTHON_SCRIPTS_PATH/opentable_restaurants.py"
+OPENTABLE_FILE="${OPENTABLE_FILE:-$INTDIR/restaurants.csv}"
TESTING_SCRIPT="$SCRIPTS_PATH/test_planet.sh"
PYTHON="$(which python2.7)"
MWM_VERSION_FORMAT="%s"
@@ -255,6 +257,13 @@ if [ "$MODE" == "coast" ]; then
echo "Hotels have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG"
fi
+ # Download opentable.com restaurants. This takes around 30 minutes.
+ if [ ! -f "$OPENTABLE_FILE" -a -n "${OPENTABLE_USER-}" -a -n "${OPENTABLE_PASS-}" ]; then
+ log "STATUS" "Step C: Starting background restaurants downloading"
+ $PYTHON $OPENTABLE_SCRIPT --client $OPENTABLE_USER --secrete $OPENTABLE_PASS --opentable_data "$INTDIR"/opentable.json --download --tsv "$OPENTABLE_FILE" 2>"$LOG_PATH"/opentable.log &
+ echo "Hotels have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG"
+ fi
+
[ ! -x "$OSMCTOOLS/osmupdate" ] && cc -x c "$OMIM_PATH/tools/osmctools/osmupdate.c" -o "$OSMCTOOLS/osmupdate"
[ ! -x "$OSMCTOOLS/osmfilter" ] && cc -x c -O3 "$OMIM_PATH/tools/osmctools/osmfilter.c" -o "$OSMCTOOLS/osmfilter"
if [ -n "$OPT_DOWNLOAD" ]; then
@@ -400,6 +409,7 @@ if [ "$MODE" == "features" ]; then
[ -n "$OPT_WORLD" ] && PARAMS_SPLIT="$PARAMS_SPLIT -generate_world"
[ -n "$OPT_WORLD" -a "$NODE_STORAGE" == "map" ] && log "WARNING: generating world files with NODE_STORAGE=map may lead to an out of memory error. Try NODE_STORAGE=mem if it fails."
[ -f "$BOOKING_FILE" ] && PARAMS_SPLIT="$PARAMS_SPLIT --booking_data=$BOOKING_FILE"
+ [ -f "$OPENTABLE_FILE" ] && PARAMS_SPLIT="$PARAMS_SPLIT --opentable_data=$OPENTABLE_FILE"
"$GENERATOR_TOOL" --intermediate_data_path="$INTDIR/" --node_storage=$NODE_STORAGE --osm_file_type=o5m --osm_file_name="$PLANET" \
--data_path="$TARGET" --user_resource_path="$DATA_PATH/" $PARAMS_SPLIT 2>> "$PLANET_LOG"
MODE=mwm