Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pmtile basemap generation and remove temp workarounds #1535

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
ARG PYTHON_IMG_TAG=3.10
ARG MINIO_TAG=${MINIO_TAG:-RELEASE.2024-01-01T16-36-33Z}
FROM docker.io/minio/minio:${MINIO_TAG} as minio
FROM docker.io/protomaps/go-pmtiles:v1.19.0 as go-pmtiles


# Includes all labels and timezone info to extend from
Expand Down Expand Up @@ -121,9 +120,6 @@ RUN set -ex \
&& rm -rf /var/lib/apt/lists/*
# Copy minio mc client
COPY --from=minio /usr/bin/mc /usr/local/bin/
# Copy go-pmtiles until for mbtiles-->pmtiles conversion
# FIXME osm-fieldwork should do this, but is currently broken
COPY --from=go-pmtiles /go-pmtiles /usr/local/bin/pmtiles
COPY *-entrypoint.sh /
ENTRYPOINT ["/app-entrypoint.sh"]
# Copy Python deps from build to runtime
Expand Down
36 changes: 9 additions & 27 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""Logic for FMTM project routes."""

import json
import subprocess
import uuid
from asyncio import gather
from io import BytesIO
Expand Down Expand Up @@ -1484,32 +1483,15 @@ def get_project_tiles(
f"tms={tms}"
)

# TODO replace this temp workaround with osm-fieldwork code
# TODO to generate pmtiles directly instead of with go-pmtiles
if output_format == "pmtiles":
create_basemap_file(
boundary=f"{min_lon},{min_lat},{max_lon},{max_lat}",
outfile=outfile.replace("pmtiles", "mbtiles"),
zooms=zooms,
outdir=tiles_dir,
source=source,
xy=False,
tms=tms,
)
subprocess.call(
"pmtiles convert " f"{outfile.replace('pmtiles', 'mbtiles')} {outfile}",
shell=True,
)
else:
create_basemap_file(
boundary=f"{min_lon},{min_lat},{max_lon},{max_lat}",
outfile=outfile,
zooms=zooms,
outdir=tiles_dir,
source=source,
xy=False,
tms=tms,
)
create_basemap_file(
boundary=f"{min_lon},{min_lat},{max_lon},{max_lat}",
outfile=outfile,
zooms=zooms,
outdir=tiles_dir,
source=source,
xy=False,
tms=tms,
)

log.info(f"Basemap created for project ID {project_id}: {outfile}")

Expand Down
8 changes: 4 additions & 4 deletions src/backend/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"cryptography>=42.0.1",
"defusedxml>=0.7.1",
"osm-login-python==1.0.3",
"osm-fieldwork==0.9.2",
"osm-fieldwork==0.10.0",
"osm-rawdata==0.3.0",
"fmtm-splitter==1.2.1",
]
Expand Down
Loading