From 5ed228c1dbcd9f1eeddb9769ca054d07132e4e63 Mon Sep 17 00:00:00 2001 From: Maksim Andrianov Date: Fri, 4 Oct 2019 17:27:58 +0300 Subject: [PATCH] [generator][python] Supported postcodes_dataset. --- tools/python/maps_generator/generator/env.py | 4 ++++ tools/python/maps_generator/generator/settings.py | 2 ++ tools/python/maps_generator/maps_generator.py | 6 +++++- .../python/maps_generator/var/etc/map_generator.ini.default | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/python/maps_generator/generator/env.py b/tools/python/maps_generator/generator/env.py index 5cad6baf63..b8681d0a79 100644 --- a/tools/python/maps_generator/generator/env.py +++ b/tools/python/maps_generator/generator/env.py @@ -219,6 +219,10 @@ class Env: def food_translations_path(self): return os.path.join(self.intermediate_path, "translations_food.json") + @property + def postcodes_path(self): + return os.path.join(self.intermediate_path, "postcodes") + @property def cities_boundaries_path(self): return os.path.join(self.intermediate_path, "cities_boundaries.bin") diff --git a/tools/python/maps_generator/generator/settings.py b/tools/python/maps_generator/generator/settings.py index 12060161be..f03c931c0a 100644 --- a/tools/python/maps_generator/generator/settings.py +++ b/tools/python/maps_generator/generator/settings.py @@ -50,6 +50,7 @@ POPULARITY_URL= "" SUBWAY_URL = "" FOOD_URL = "" FOOD_TRANSLATIONS_URL = "" +POSTCODES_URL = "" SRTM_PATH = "" STATS_TYPES_CONFIG = "" @@ -122,6 +123,7 @@ PROMO_CATALOG_CITIES_URL = _get_opt_path(config, "External", "PROMO_CATALOG_CITI POPULARITY_URL = _get_opt_path(config, "External", "POPULARITY_URL", POPULARITY_URL) SUBWAY_URL = _get_opt(config, "External", "SUBWAY_URL", SUBWAY_URL) FOOD_URL = _get_opt(config, "External", "FOOD_URL", FOOD_URL) +POSTCODES_URL = _get_opt(config, "External", "POSTCODES_URL", POSTCODES_URL) FOOD_TRANSLATIONS_URL = _get_opt(config, "External", "FOOD_TRANSLATIONS_URL", FOOD_TRANSLATIONS_URL) SRTM_PATH = _get_opt_path(config, "External", "SRTM_PATH", SRTM_PATH) diff --git a/tools/python/maps_generator/maps_generator.py b/tools/python/maps_generator/maps_generator.py index c445dad4b2..67db2cb551 100644 --- a/tools/python/maps_generator/maps_generator.py +++ b/tools/python/maps_generator/maps_generator.py @@ -66,6 +66,7 @@ def stage_download_production_external(env): settings.POPULARITY_URL: env.popularity_path, settings.FOOD_URL: env.food_paths, settings.FOOD_TRANSLATIONS_URL: env.food_translations_path, + settings.POSTCODES_URL: env.postcodes_path, }) @@ -120,7 +121,10 @@ def stage_index(env, country, **kwargs): elif country == WORLD_COASTS_NAME: stages.stage_coastline_index(env, country, **kwargs) else: - stages.stage_index(env, country, **kwargs) + extra = {} + if env.is_accepted_stage(stage_download_production_external): + extra["postcodes_dataset"] = env.postcodes_path + stages.stage_index(env, country, **kwargs, **extra) @country_stage diff --git a/tools/python/maps_generator/var/etc/map_generator.ini.default b/tools/python/maps_generator/var/etc/map_generator.ini.default index 823c2fba74..98d23b97a0 100644 --- a/tools/python/maps_generator/var/etc/map_generator.ini.default +++ b/tools/python/maps_generator/var/etc/map_generator.ini.default @@ -34,6 +34,7 @@ SUBWAY_URL: http://osm-subway.maps.me/mapsme/latest.json # POPULARITY_URL: # FOOD_URL: # FOOD_TRANSLATIONS_URL: +# POSTCODES_URL: # SRTM_PATH: [Stats]