Frontend example for testing tiles cutter and gnss scan
This commit is contained in:
parent
b2eaaccbb8
commit
aaab394086
51 changed files with 7444 additions and 9 deletions
|
|
@ -17,13 +17,17 @@ class TileCutError(RuntimeError):
|
|||
|
||||
|
||||
class TileService:
|
||||
def __init__(self, tiles_dir: Path, placeholder: Path):
|
||||
def __init__(self, tiles_dir: Path, placeholder: Path, upload_dir: Path):
|
||||
self.tiles_dir = Path(tiles_dir)
|
||||
self.placeholder = Path(placeholder)
|
||||
self.upload_dir = Path(upload_dir)
|
||||
|
||||
def ensure_tiles_dir(self) -> None:
|
||||
self.tiles_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def ensure_upload_dir(self) -> None:
|
||||
self.upload_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def _find_gdal2tiles(self) -> str:
|
||||
for name in ("gdal2tiles.py", "gdal2tiles"):
|
||||
found = shutil.which(name)
|
||||
|
|
@ -77,3 +81,5 @@ class TileService:
|
|||
if self.placeholder.is_file():
|
||||
return FileResponse(self.placeholder, media_type="image/png")
|
||||
return Response(content=DEFAULT_PLACEHOLDER_PNG, media_type="image/png")
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue