mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
rio pmtiles: Add "PMTiles metadata attribution" to the Python code (#570)
* rio pmtiles: Add "PMTiles metadata attribution" to the Python code * rio pmtiles: Add "tileSize" to the Metadata
This commit is contained in:
@@ -47,6 +47,7 @@ Usage
|
|||||||
|
|
||||||
--name TEXT PMTiles metadata name.
|
--name TEXT PMTiles metadata name.
|
||||||
--description TEXT PMTiles metadata description.
|
--description TEXT PMTiles metadata description.
|
||||||
|
--attribution TEXT PMTiles metadata attribution.
|
||||||
--overlay Export as an overlay (the default).
|
--overlay Export as an overlay (the default).
|
||||||
--baselayer Export as a base layer.
|
--baselayer Export as a base layer.
|
||||||
-f, --format [JPEG|PNG|WEBP] Tile image format. [default: WEBP]
|
-f, --format [JPEG|PNG|WEBP] Tile image format. [default: WEBP]
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ def guess_maxzoom(crs, bounds, width, height, tile_size):
|
|||||||
@output_opt
|
@output_opt
|
||||||
@click.option("--name", help="PMTiles metadata name.")
|
@click.option("--name", help="PMTiles metadata name.")
|
||||||
@click.option("--description", help="PMTiles metadata description.")
|
@click.option("--description", help="PMTiles metadata description.")
|
||||||
|
@click.option("--attribution", help="PMTiles metadata attribution.")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--overlay",
|
"--overlay",
|
||||||
"layer_type",
|
"layer_type",
|
||||||
@@ -226,6 +227,7 @@ def pmtiles(
|
|||||||
output,
|
output,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
|
attribution,
|
||||||
layer_type,
|
layer_type,
|
||||||
img_format,
|
img_format,
|
||||||
tile_size,
|
tile_size,
|
||||||
@@ -300,6 +302,7 @@ def pmtiles(
|
|||||||
# Name and description.
|
# Name and description.
|
||||||
name = name or os.path.basename(src.name)
|
name = name or os.path.basename(src.name)
|
||||||
description = description or src.name
|
description = description or src.name
|
||||||
|
attribution = attribution or None
|
||||||
|
|
||||||
# Compute the geographic bounding box of the dataset.
|
# Compute the geographic bounding box of the dataset.
|
||||||
(west, east), (south, north) = transform(
|
(west, east), (south, north) = transform(
|
||||||
@@ -374,7 +377,7 @@ def pmtiles(
|
|||||||
outfile.write(b"\x00" * 16384)
|
outfile.write(b"\x00" * 16384)
|
||||||
entries = []
|
entries = []
|
||||||
|
|
||||||
metadata = gzip.compress(json.dumps({'name':name,'type':layer_type,'description':description,'writer':f'rio-pmtiles {rio_pmtiles_version}'}).encode())
|
metadata = gzip.compress(json.dumps({'name':name,'type':layer_type,'description':description,'writer':f'rio-pmtiles {rio_pmtiles_version}','attribution':attribution,'tileSize':int(tile_size)}).encode())
|
||||||
outfile.write(metadata)
|
outfile.write(metadata)
|
||||||
|
|
||||||
header = {}
|
header = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user