mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
download_natural_earth
This commit is contained in:
@@ -16,8 +16,8 @@ def download_fonts(assets_dir: Path):
|
||||
|
||||
fonts_temp = assets_dir / 'fonts_temp'
|
||||
|
||||
for font in ['ml', 'omt', 'pm']:
|
||||
url = f'https://assets.openfreemap.com/fonts/{font}.tgz'
|
||||
for font in ['ofm']:
|
||||
url = f'https://assets.openfreemap.com/fonts/{font}.tar.gz'
|
||||
local_file = fonts_dir / f'{font}.tgz'
|
||||
if not download_if_size_differs(url, local_file):
|
||||
continue
|
||||
@@ -41,3 +41,26 @@ def download_fonts(assets_dir: Path):
|
||||
shutil.rmtree(target_dir_renamed, ignore_errors=True)
|
||||
|
||||
shutil.rmtree(fonts_temp, ignore_errors=True)
|
||||
|
||||
|
||||
def download_natural_earth(assets_dir: Path):
|
||||
ne_dir = assets_dir / 'natural_earth'
|
||||
|
||||
if (ne_dir / 'tiles' / 'natural_earth_2_shaded_relief.raster' / '0' / '0' / '0.png').exists():
|
||||
return
|
||||
|
||||
ne_dir.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
subprocess.run(
|
||||
[
|
||||
'git',
|
||||
'clone',
|
||||
'--depth=1',
|
||||
'-b',
|
||||
'gh-pages',
|
||||
'https://github.com/lukasmartinelli/naturalearthtiles.git',
|
||||
ne_dir,
|
||||
]
|
||||
)
|
||||
|
||||
shutil.rmtree(ne_dir / '.git')
|
||||
@@ -40,6 +40,7 @@ def get_remote_file_size(url: str) -> int | None:
|
||||
|
||||
def download_file_aria2(url: str, local_file: Path):
|
||||
print(f' downloading: {url} into {local_file}')
|
||||
local_file.unlink(missing_ok=True)
|
||||
|
||||
subprocess.run(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user