feat(map): persist city building tiles
This commit is contained in:
@@ -23,6 +23,7 @@ export const cityManifestSchema = z
|
||||
.object({
|
||||
schema_version: z.literal(1),
|
||||
name: z.string(),
|
||||
generated_at: z.string().datetime({ offset: true }).optional(),
|
||||
bbox: z.tuple([
|
||||
z.number().min(-180).max(180),
|
||||
z.number().min(-90).max(90),
|
||||
@@ -33,14 +34,29 @@ export const cityManifestSchema = z
|
||||
pipe_count: z.number().int().nonnegative(),
|
||||
asset_count: z.number().int().nonnegative(),
|
||||
notice: z.string(),
|
||||
attribution: z.string()
|
||||
attribution: z.string(),
|
||||
tiles: z
|
||||
.object({
|
||||
buildings: z.object({
|
||||
sha256: z
|
||||
.string()
|
||||
.regex(/^[a-f0-9]{64}$/)
|
||||
.optional()
|
||||
})
|
||||
})
|
||||
.optional()
|
||||
})
|
||||
.refine(({ bbox: [w, s, e, n] }) => w < e && s < n, "Invalid scene bounds");
|
||||
|
||||
export function cityBuildingArchiveUrl(origin = window.location.origin) {
|
||||
return new URL(`${CITY_ROOT}/buildings.pmtiles`, origin).href;
|
||||
}
|
||||
|
||||
export function citySources(): Record<string, SourceSpecification> {
|
||||
return {
|
||||
[CITY_PREFIX + "buildings"]: {
|
||||
type: "vector",
|
||||
url: `pmtiles://${window.location.origin}${CITY_ROOT}/buildings.pmtiles`,
|
||||
url: `pmtiles://${cityBuildingArchiveUrl()}`,
|
||||
minzoom: 12,
|
||||
maxzoom: 16,
|
||||
attribution:
|
||||
|
||||
Reference in New Issue
Block a user