Skip to content

Commit

Permalink
Add language support for each tiler layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jul 26, 2024
1 parent 5fb4a1a commit 15e5a39
Show file tree
Hide file tree
Showing 31 changed files with 563 additions and 99 deletions.
1 change: 0 additions & 1 deletion compose/tiler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
db:
image: ohm-tiler-db:v1
Expand Down
20 changes: 19 additions & 1 deletion images/tiler-server/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,38 @@
parser = argparse.ArgumentParser(description='Merge TOML files into a configuration file.')
parser.add_argument('--template', default='config/config.template.toml', help='Path to the configuration template file.')
parser.add_argument('--providers', default='config/providers', help='Directory containing provider TOML files.')
parser.add_argument('--languages', default='config/lenguages.sql', help='Path to the languages SQL file.')
parser.add_argument('--output', default='config/config.toml', help='Output configuration file path.')
args = parser.parse_args()

config_template_file = args.template
providers_dir = args.providers
languages_file = args.languages
output_file_path = args.output

# Read the content of lenguages.sql
with open(languages_file, "r") as file:
languages_content = file.read().strip()

toml_files = [file for file in os.listdir(providers_dir) if file.endswith(".toml")]

# Read TOML files
new_configs = {}
for toml_file in toml_files:
dir_toml_file = os.path.join(providers_dir, toml_file)
with open(dir_toml_file, "r") as file:
new_configs[dir_toml_file] = file.read()
provider_toml_content = file.read()

if '{{LENGUAGES}}' in provider_toml_content:
languages_content_fixed = languages_content.replace("\n", " ")
provider_toml_content = provider_toml_content.replace('{{LENGUAGES}}', languages_content_fixed)

if '{{LENGUAGES_RELATION}}' in provider_toml_content:
languages_content_fixed = languages_content.replace("\n", " r.")
languages_content_fixed = f"r.{languages_content_fixed}"
provider_toml_content = provider_toml_content.replace('{{LENGUAGES_RELATION}}', languages_content_fixed)

new_configs[dir_toml_file] = provider_toml_content

with open(config_template_file, "r") as main_file:
content = main_file.read()
Expand Down
3 changes: 0 additions & 3 deletions images/tiler-server/config/config.template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ max_connections = 200
[['providers/water_areas_ne.toml']]

###### Admin boundaries providers
# [['providers/admin_boundaries_areas.toml']]
[['providers/admin_boundaries_lines.toml']]
[['providers/admin_boundaries_centroids.toml']]

Expand All @@ -66,7 +65,6 @@ max_connections = 200

###### Place points and areas
[['providers/place_points.toml']]
# [['providers/place_areas.toml']]

###### Other (Man Made, Historic, Military, Power, Barrier etc)
[['providers/other_points.toml']]
Expand Down Expand Up @@ -103,7 +101,6 @@ center = [-74.275329586789, -12.153492567373, 8.0]
[['providers/land.zoom.toml']]

##### Admin boundaries display zooms
# [['providers/admin_boundaries_areas.zoom.toml']]
[['providers/admin_boundaries_lines.zoom.toml']]
[['providers/admin_boundaries_centroids.zoom.toml']]

Expand Down
Loading

0 comments on commit 15e5a39

Please sign in to comment.