Skip to content

Commit

Permalink
Added int output for post
Browse files Browse the repository at this point in the history
  • Loading branch information
dsparber committed Nov 12, 2024
1 parent 9ed0048 commit 37fe267
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
4 changes: 4 additions & 0 deletions commons/r2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ def ubmeteo_app_prod(self) -> Bucket:
@property
def post_playground(self) -> Bucket:
return self.client.Bucket("post-playground")

@property
def post_playground_int(self) -> Bucket:
return self.client.Bucket("post-playground-int")
45 changes: 26 additions & 19 deletions main/post/post_global_relief.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,26 @@
),
}

with BytesIO() as file:
tile_json = dict(
tilejson="3.0.0",
name="global-relief",
version="1.0.0",
format="jpeg",
tiles=[
"https://post-playground-dev.openmobilemaps.io/v1/background/global-relief/light/4326/{z}/{x}/{y}.jpg"
],
minzoom=0,
maxzoom=max_zoom,
)
file.write(json.dumps(tile_json).encode("UTF-8"))
file.flush()
file.seek(0)
BucketOutput(
bucket=r2.post_playground,
cache_control=cache_control_test,
).upload(file, f"v1/background/global-relief/{style}/tiles.json")
for bucket in [r2.post_playground, r2.post_playground_int]:
with BytesIO() as file:
tile_json = dict(
tilejson="3.0.0",
name="global-relief",
version="1.0.0",
format="jpeg",
tiles=[
"https://post-playground-dev.openmobilemaps.io/v1/background/global-relief/light/4326/{z}/{x}/{y}.jpg"
],
minzoom=0,
maxzoom=max_zoom,
)
file.write(json.dumps(tile_json).encode("UTF-8"))
file.flush()
file.seek(0)
BucketOutput(
bucket=bucket,
cache_control=cache_control_test,
).upload(file, f"v1/background/global-relief/{style}/tiles.json")

for dataset_path, tiles in dataset_to_tiles.items():
storage_path = f"v1/background/global-relief/{style}/4326"
Expand All @@ -75,6 +76,12 @@
base_path=storage_path,
cache_control=cache_control_test,
file_ending="jpg",
),
BucketTileOutput(
bucket=r2.post_playground_int,
base_path=storage_path,
cache_control=cache_control_prod,
file_ending="jpg",
)
]
),
Expand Down

0 comments on commit 37fe267

Please sign in to comment.