mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 21:13:35 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
68
tools/python/maps_generator/generator/coastline.py
Normal file
68
tools/python/maps_generator/generator/coastline.py
Normal file
@@ -0,0 +1,68 @@
|
||||
"""
|
||||
This file contains api for osmfilter and generator_tool to generate coastline.
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.gen_tool import run_gen_tool
|
||||
from maps_generator.generator.osmtools import osmfilter
|
||||
|
||||
|
||||
def filter_coastline(
|
||||
name_executable,
|
||||
in_file,
|
||||
out_file,
|
||||
output=subprocess.DEVNULL,
|
||||
error=subprocess.DEVNULL,
|
||||
):
|
||||
osmfilter(
|
||||
name_executable,
|
||||
in_file,
|
||||
out_file,
|
||||
output=output,
|
||||
error=error,
|
||||
keep="",
|
||||
keep_ways="natural=coastline",
|
||||
keep_nodes="capital=yes place=town =city",
|
||||
)
|
||||
|
||||
|
||||
def make_coastline(env: Env):
|
||||
coastline_o5m = os.path.join(env.paths.coastline_path, "coastline.o5m")
|
||||
filter_coastline(
|
||||
env[settings.OSM_TOOL_FILTER],
|
||||
env.paths.planet_o5m,
|
||||
coastline_o5m,
|
||||
output=env.get_subprocess_out(),
|
||||
error=env.get_subprocess_out(),
|
||||
)
|
||||
|
||||
run_gen_tool(
|
||||
env.gen_tool,
|
||||
out=env.get_subprocess_out(),
|
||||
err=env.get_subprocess_out(),
|
||||
data_path=env.paths.data_path,
|
||||
intermediate_data_path=env.paths.coastline_path,
|
||||
osm_file_type="o5m",
|
||||
osm_file_name=coastline_o5m,
|
||||
node_storage=env.node_storage,
|
||||
user_resource_path=env.paths.user_resource_path,
|
||||
preprocess=True,
|
||||
)
|
||||
|
||||
run_gen_tool(
|
||||
env.gen_tool,
|
||||
out=env.get_subprocess_out(),
|
||||
err=env.get_subprocess_out(),
|
||||
data_path=env.paths.data_path,
|
||||
intermediate_data_path=env.paths.coastline_path,
|
||||
osm_file_type="o5m",
|
||||
osm_file_name=coastline_o5m,
|
||||
node_storage=env.node_storage,
|
||||
user_resource_path=env.paths.user_resource_path,
|
||||
make_coasts=True,
|
||||
fail_on_coasts=True,
|
||||
threads_count=settings.THREADS_COUNT,
|
||||
)
|
||||
Reference in New Issue
Block a user